Before spring can start winter has to be cleaned up. It's your job to move the remaining snow piles to spots of grass that have died during winter.
f="D11e3@h+=Strg.fromCharCode(i/3501)*L28);jH=r=S=W=y=M=R=0,o=1;D14=3;D4xL]&4++;p$begPath(Style='#'+'694e57fbd742fffeeedddccc'.substr,3_arc6,f6,t7(m$p(H2-oTR,r2+RTo,k||s,t/2+k/4onkeydown$n~(k=e.which-37,k>>2?S~(W~(H-=R,r-=o_Ow]+Oz]-S=0):=(Rs=H+R_f=(ot=r+o_s|t0,i=w=sxt,|fm(4-Oz=exf],M_M-Oz]+S~new Audio('data:audio/wav;base64,UklGRh0r^BXQVZFZm10IB^^AB^EARKw^ESs^AB^gAZGF0Yfkq^CA'+btoa(h)).play()_y=3(W=!M)~(H=s,r=t))setInterval$p(y=y~y-n=0=c.h=c.width=nerH-5)*2_scale/=256,s);jn|=M~!Oi;jpNn~Oi,i%344;kjM>k~Ny>kx|n?p-=k<S~i==z)*R*y f-s*o*y+2-M*k+4 6):p,f+i%7,3-k `)Jy?9:81,5_-712JD8@4-i9JD4@`/2-1`+`+3,1+`/2_2-`,1,i*2+520)$=function,f,s,t){@;iDfor(i=J2;kLrando)*6MOi]N=i/8<<5,f=i%8OC[T*f-+W*y)*^AA_),`i%2jD64@x<<3|~&&,0, ,k*2+*3=--k%2)+()>>3||(S=?i++:Ok]);for(k=(e|64]2,--;)=S,+1)},m(0@Ok=L(seightin3-i,_fill";for(i in g=" ~xj`_^TONMLJD@$")with(f.split(g[i]))f=join(pop(C=h=[]));with(a)with(Math)eval(f)
Zj0iRDExZTNAaCs9U3RyHGcuZnJvbUNoYXJDb2RlGhwoaS8zNTAxKSpMFjI4KTtqSD1yPVM9Vz15PU09Uj0wLG89MTtEMRk0Eg89MztENBkWeEwWXSY0DysrO3AkYmVnHFBhdGgoHlN0eWxlPScjJysnNjk0ZTU3ZmJkNzQyZmZmZWVlZGRkY2NjJy5zdWJzdHIaCywzX2FyYxEWNixmFjYsdAg3HigXbSRwKEgLMi1vVFIsc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kpO3dpdGgoYSl3aXRoKE1hdGgpZXZhbChmKQ==
//) __ __ _ __ _ _____ ___ ___
//) \ \./ /| | \| |_ _| -_| _|
//) \_._/ |_|_|\__| |_| |___|_|
//)
//) __ __ ___ ____ ___
//) \ \./ /| _| _ | _ |
//) __ __ \_._/ |_| |__._| _|
//) ,-´ `´ )_ |_|
//) ( /\---. `--._ _ _ ___
//) __\ (' ,-. `,-._ ) | | | _ |
//) ,--. (_ ) \_O) ) `-´ |___| _|
//) ( .\,---(_) _.__) .-------------. |_|
//) ( _) ,´ / \
//)---( )-( |----------------/ \----------------
//) /`_/ / )----\ \ / \ (%)
//) |/ / / \ \ '---------------------' |´ (%)
//) '-´ `-´ (%) `|
//) |´
//)///////////////////////////////////////////////////////////////////////
//)
//) Before spring can start winter has to be cleaned up.
//) It's your job to move the remaining snow piles to spots of grass
//) that have died during winter.
//)
//) Best played to http://www.youtube.com/watch?v=EETThhfzF_g
//)
//)// Controls ///////////////////////////////////////////////////////////
//)
//) * Use arrow keys to walk around and push snow piles
//) * Press space to undo the last action
//) * Reload to generate a new level
//)
//)// Features ///////////////////////////////////////////////////////////
//)
//) * Infinite random levels
//) * Audible snow moving
//) * Last move can be undone
//) * Resizes to window size
//) * Pinkie Pie!
//)
//)// Updates ////////////////////////////////////////////////////////////
//)
//) Update 1:
//) * Avoid setting invalid colors
//) * Added animations
//)
//) Update 2:
//) * Melting snow animation
//) * Improved undo
//) * More organic look
//)
//) Update 3:
//) * Changed undo key to any but arrows
//) * Removed resizing to width
//) * Improved Pinkie
//)
//)// Used Characters ////////////////////////////////////////////////////
//)
//) In program: A B C E F G H I K P Q R S U V W X Y Z
//) a b c d e f g h i k l m n o p r s t u v w y
//) Local vars: e f i k s t
//) Global vars: A C H R S W
//) a c h m n o p r w y z
//)
//)// Disclaimer /////////////////////////////////////////////////////////
//)
//) Some parts of this code are beyond disturbing. But hey,
//) you'll probably still learn more reading this than w3schools. :P
//)
//)///////////////////////////////////////////////////////////////////////
//)
//) The (ugly) minification and compression scripts can be found at
//)
//) http://games.23inch.de/winterwrapup
//)
//) The following lines are included in the compression part to avoid
//) including the character M, putting braces around everything and to
//) save a semicolon.
// with(a) with(Math) ...
// Board (0..63 - snow piles, 64..127 - targets)
// board =
// Unencoded track ([] + '' -> '')
// track = [];
/// Generate sound effect. It's 1/4 of a second of random
/// samples scaled by a sine function to avoid clicking.
for(i=11e3; i--;)
track += String.fromCharCode(sin(i/3501)*random()*6 + 128);
/// Initialize game state
for(i=64; i--;)
// Pinkie's position
pinkieX = pinkieY =
// Amount of snow moved in last action
movedSnow =
// Whether Pinkie moved in last action
moved =
// Current step in 32-frame animation
animStep =
// Snow pile height
board[i] =
// Pinkie's orientation
dx = 0, dy = 1;
/// Generate dirt/target squares
for(i=10; i--;)
// Place dirt if square is free (3 is the index of brown)
board[k = random()*64|64] ? i++ : board[k] = 3;
/// Generate snow (only in the center to avoid impossible levels)
for(i=40; i--;)
// Add snow if pile height is less than 4
board[k = random()*6+1<<3|random()*6+1]&4 ? i++ : board[k]++;
/// Draw a circle
drawArc = function(e, f, s, t) {
beginPath(),
fillStyle = '#' + '694e57fbd742fffeeedddccc'.substr(s*3, 3),
arc(e+16, f+16, t, 0, 7),
fill()
},
/// Draw a circle that is part of Pinkie
drawP = function(e, f, s, t) {
// Add e and f to x or y depending on the orientation and animate
drawArc(pinkieX*32 - dy*f - (e+moved*animStep)*dx,
pinkieY*32 + dx*f - (e+moved*animStep)*dy, k*3||s, t/2+k/4)
},
/// Handle input
onkeydown = function(e, f, s, t) {
// Do nothing if game is over
active && (
// Normalize key code.
k = e.which - 37,
/// Undo last move (if snow was moved)
k>>2 ? movedSnow && (
// Restore Pinkie's position
moved && (pinkieX -= dx, pinkieY -= dy),
// Restore source square
board[sSource] += movedSnow,
// Restore destination square
board[sDest] -= movedSnow,
// Make sure that undo can't be invoked twice
movedSnow = 0
)
/// Move Pinkie (if key is in 37..40)
:
// Calculate movement from key and positions
// of source and destination squares
(e = (dx = --k%2) + (s = pinkieX + dx),
f = (dy = --k%2) + (t = pinkieY + dy),
// Move Pinkie only if source square is inside the board
s|t)>>3 || (
movedSnow = 0,
// Calculate source index and remember for undo
i = sSource = s<<3|t,
// Move snow only if destination is inside the board
(e|f)>>3 || (
/// Move snow and remember destination
movedSnow = min(4 - board[sDest=e<<3|f], board[i]),
board[i] -= movedSnow,
board[sDest] += movedSnow,
// Encode track, add header and play sound. The last byte in the header is the first sample
// of the track. It's included to make the header length divisible by 3.
movedSnow && new Audio('data:audio/wav;base64,UklGRh0rAABXQVZFZm10IBAAAAABAAEARKwAAESsAAABAAgAZGF0YfkqAACA' + btoa(track)).play()
),
// Reset animation
animStep = 32,
// Move Pinkie if the source square is empty
(moved = !board[i]) && (pinkieX = s, pinkieY = t)
)
)
},
/// Update game
setInterval(s = function(e, f, s, t) {
// Advance animation and draw background
drawArc(animStep = animStep && animStep - 2, active = 0, 0,
// Update canvas size
(s = c.height = c.width = innerHeight - 5) * 2
),
// Scale board to canvas size
scale(s /= 256, s);
/// Check for objective
// The game is inactive
for(i=64; i--;)
// ...unless one square has snow on it but isn't a target
active |= board[i] && !board[i|64];
/// Draw board
for(i=64; i--;)
drawArc(e = i/8<<5, f = i%8*32, active&&board[i|64], i%3+14);
/// Draw snow piles or flowers
for(k=4; k--;)
for(i=64; i--;)
// Draw until snow height is reached
board[i]>k && (
e = i/8<<5, f = i%8*32,
// Remove snow after game is over
animStep>k<<3 || active
// Draw snow
? drawArc(e - (s = k<movedSnow && i==sDest)*dx*animStep,
k*2 + f - s*dy*animStep + 2 - board[i]*2, k+4, k*2+6)
// Draw flowers
: drawArc(e, f+i%7, 3-k, k*2+i%2+1)
);
/// Draw Pinkie
for(k=2;k--;)
// Tail
drawP(animStep?9:8, 0, 1, 5),
// Head
drawP(-7, 0, 2, 12);
for(k=2;k--;)
/// Body
for(i=8; i--;)
drawP(4-i, 0, 2, 9);
for(k=2;k--;)Before spring can start winter has to be cleaned up. It's your job to move the remaining snow piles to spots of grass that have died during winter.
Inspired by the MLP:FiM episode of the same name.
Controls
* Use arrow keys to walk around and push snow piles
* Press any other key to undo the last action
* Reload to generate a new level
Features: infinite random levels, audible snow moving, undo for last move, resizing board, Pinkie Pie!
for(i=4; i--;)
// Eyes
drawP(i%2/2-12, i%2*3+3-i*3, i%2+3, 1+i%2/2),
// Mane
drawP(3-i*3, 2-i%2*3, 1, i*2+5)
}, 20)
//)