Now updated implementation of Slime Volleyball, a sort-of-cult web game from around a decade ago. The game is volleyball. You play as the yellow "slime" on the left, the computer plays the green slime…
f='c.width=60`c.height=h=A`a.font="5ex y",R=T=P=Q=W=`C%down%upHs)return(I=i.which)?(e=i.type[5],I^65?I^68?I^87JR:Lk?Nmax(j,Nmin(k,i)$i*i+j*jBOHa)EStyle="#"+"fff000f0".substr(i,3_!m&&EText(G||A_m>2?ERect(G,m(beginPath(_arc(G,NPI*m,`0_E()BSHm)xDx+v,k,l_yDy+w,`h_w=y^h?w+.5:J?-9@v=L?-6:R?6@fDd=X-xy_f<52Fg/f,b/f,X=x+52*g,Y=y+52*b,f=2*(g*(U-v)+b*(V-w)_dD12/C(Uv-f*g,Vw-f*b_`1_U**1.;V*Ki,x,y,4`1g=x+20-j,b=y-2`8,2_f=4/C(d=X-gbK3,g+d*f,b+e*f,4,2K;"❤",x+j/2-A,~~y_jFd=$V*V+y-40-Y)-V,e=X+U*d*;f=x-20-e,g>30;L=g&f>6,R=g&f<-6,J=!J&g&d<12&!+(d+"")[5]BsetInterval(zP?(O(4,``60`h_YV.5,dDXU,1;588_X!FX_(P=Y<268)(Q=X>302)?++R:++T)^6FW=99_S(1,`4`258,s_S(5,4`34;56`t_X^C(X,A6,314)Y>240?(X=U>0?A6:314Y>2AFY=2A,V=-V)298,24`4,40X,Y,1;2R,9T,570)(P=!W--)FsZY=99},tZ501},X=(Q?t:s).x,U=V=0B20)zfunction(i,G,m){`0,_),Z={y:h,v@w@L@R@J@x:NMath.K_O(H=zwith(Gj,k,lF&&(EfillD=C(B)},A28@:`;2,%=onkey$Nsqrt():,e=Y-,U=-U||(=e=d+=K`';for(i in g='$%;@ABDEFGHKNZ_`z')e=f.split(g[i]),f=e.join(e.pop());eval(f)
Zj0nYy53aWR0aD02MGBjLmhlaWdodD1oPUFgYS5mb250PSI1ZXggeSIsUj1UPVA9UT1XPWBDJWRvd24ldXBIcylyZXR1cm4oST1pLndoaWNoKT8oZT1pLnR5cGVbNV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9ua2V5JE5zcXJ0KB8pOh4sZT1ZLR0sVT0tVRx8fCgbPWUaPWQZKz0YS2AnO2ZvcihpIGluIGc9JxgZGhscHR4fJCU7QEFCREVGR0hLTlpfYHonKWU9Zi5zcGxpdChnW2ldKSxmPWUuam9pbihlLnBvcCgpKTtldmFsKGYp
c.width = 600,
c.height = h = 280,
a.font = "5ex y",
R = T = P = Q = W = 0,
// Combined function to handle keypresses, calculate the size of a vector or clamp a number between a minimum and maximum
C = onkeydown = onkeyup = function(i, j, k, l, m) {
with (s) return (I = i.which) ?
(e = i.type[5], I ^ 65 ? I ^ 68 ? I ^ 87 || (J = e) : R = e : L = e) : k ? Math.max(j, Math.min(k, i)) : Math.sqrt(i * i + j * j)
},
// Draw stuff on the canvas, including text, circles, semi-circles or rectangles
O = function(i, j, k, l, m) {
with (a)
fillStyle = "#"+"fff000f0".substr(i, 3),
!m && fillText(j, k, l || 28),
m > 2 ? fillRect(j, k, l, m) : (beginPath(), arc(j, k, l, Math.PI * m, 0, 0), fill())
},
// Draw a slime
S = function(i, j, k, l, m) {
with (m)
// Move slime using velocities from the previous frame
x = C(x + v, k, l),
y = C(y + w, 0, h),
// Apply gravity and jumping
w = y ^ h ? w + .5 : J ? -9 : 0,
// Set intial slime velocity from keyboard input / AI
v = L ? -6 : R ? 6 : 0,
// Check collision with ball
f = C(d = X - x, e = Y - y),
f < 52 && (
g = d / f,
b = e / f,
// Push the ball away to eliminate overlap
X = x + 52 * g,
Y = y + 52 * b,
// Update the ball's velocity
f = 2 * (g * (U - v) + b * (V - w)),
// Fudge things slightly by doctoring the ball's velocity
d = C(12 / C(U += v - f * g, V += w - f * b), 0, 1),
U *= d * 1.2,
V *= d
),
// Draw body
O(i, x, y, 40, 1),
// Draw the eyeball
O(0, g = x + 20 - j, b = y - 20, 8, 2),
// Draw the pupil
f = 4 / C(d = X - g, e = Y - b),
O(3, g + d * f, b + e * f, 4, 2),
// Draw the heart. y coordinate is floored to prevent flappy hearts in Opera on Mac.
O(2, "❤", x + j / 2 - 28, ~~y),
// AI
j && (
// Decide whether to move or jump the computer slime next frame
// Calculate the x coordinate of the ball when it reaches a point near the slime's eye
d = Math.sqrt(V * V + y - 40 - Y) - V,
e = X + U * d * 2,
f = x - 20 - e,
g = e > 302,
L = g & f > 6,
R = g & f < -6,
J = !J & g & d < 12 & !+(d+"")[5]
)
},
setInterval(function(i, j, k, l, m) {
P ? (
// Clear the screen
O(4, 0, 0, 600, h),
// Update ball position from velocity and apply gravity to it
Y += V += .5,
// Bounce off walls
d = C(X += U, 12, 588),
X != d && (X = d, U = -U),
// Check for end of point (ball hitting the ground)
(P = Y < 268) ||
((Q = X > 302) ? ++R : ++T) ^ 6 && (W = 99),
// For each slime, update its position from its velocity, check for collision with the ball and draw it
S(1, 0, 40, 258, s),
S(5, 40, 342, 560, t),
// Check for a collision between ball and net
X ^ C(X, 286, 314) || (Y > 240 ? (X = U > 0 ? 286 : 314, U = -U) : Y > 228 && (Y = 228, V = -V)),
// Draw the net
O(0, 298, 240, 4, 40),
// Draw the ball
O(0, X, Y, 12, 2),
// Draw scores
O(0, R, 9),
O(0, T, 570)
):(P=!W--) && (
// Start a new point
s = {y: h, v: 0, w: 0, L: 0, R: 0, J: 0, x: Y = 99},
t = {y: h, v: 0, w: 0, L: 0, R: 0, J: 0, x: 501},
X = (Q ? t : s).x,
U = V = 0
)
},20)