Press any button to play; you are the Blue Hippo on the right. The classic board game in the browser.
for(c.width=c.height=W=510,a.font="3em a",z=j=15,N=99,f=255,F=40,E=50,S=0,T=10,l=[],o=[],p=Math,q=2*p.PI,r=p.random,s=p.sqrt,t=p.abs,P=p.pow,onkeyup=onkeydown=function(d){o[0][0]=d.type[5]?1:-1},A=function(d,b,g,e,w){with(a)e+1&&(fillStyle="#"+"0ff0f009000fff".substr(e,3)),w?fillText(g,d,b):(beginPath(),arc(d,b,g,q,0,0),fill());return A},C=function(d,b,g,e,w){z<(b+=d)?b=z:0>b&&(b=0);b%z||(d=b&&j?-1:0);for(u=0,k=8*b-f,V=function(Z,M,U,G,D){A(f+g*(k+M)-(g||Z),f+e*(k+M)-(e||Z),U,G,D);return V};n=l[u++];)if(1^n)with(n)j||(v=F<s(P(x-f,2)+P(y-f,2))?-0.15:0.4,x+=X+=v/2*(x>f?1:-1)-1.0E-4,y+=Y+=v/2*(y>f?1:-1),A(x,y,z,11)),s(P(x-f-g*(k+E),2)+P(y-f-e*(k+E),2))<F-T&&(~d?(X=g*3*d||X)&&(Y=e*3*d||Y):S++&&(1^n&&w++,l[u-1]=1));A(T+j*E,E,w,j,1);V(0,E,F+b/3)(0,z,E)(z,F,T+b/3,11)(-z,F,T+b/3)(z,44,5,8)(-z,44,5);return arguments};--j+1;)l.push({x:N+f*r(),y:N+f*r(),X:0,Y:0})&&4>j&&o.push([0,0,j&&2-j,3-j&&1-j,0]);setInterval(function(){A(f,f,W,7)(f,f,f,4);for(j=0,I=0|r()*N;i=o[j];j++)o[j]=C.apply(c,i);o[++I]&&S<=z&&(o[I][0]=1)},z);
Zm9yKGMud2lkdGg9Yy5oZWlnaHQ9Vz01MTAsYS5mb250PSIzZW0gYSIsej1qPTE1LE49OTksZj0yNTUsRj00MCxFPTUwLFM9MCxUPTEwLGw9W10sbz1bXSxwPU1hdGgscT0yKnAuUEkscj1wLnJhbmRvbSxzPXAuc3FydCx0PXAuYWJzLFA9cC5wb3csb25rZXl1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KSpOO2k9b1tqXTtqKyspb1tqXT1DLmFwcGx5KGMsaSk7b1srK0ldJiZTPD16JiYob1tJXVswXT0xKX0seik7
// setup
for (c.width = c.height = W = 510, a.font = '3em a', z = j = 15, N=99, f = 255, F=40, E=50, S = 0, T = 10, l = [], o = [], p = Math, q = 2 * p.PI, r = p.random, s = p.sqrt, t = p.abs, P=p.pow,
// spacebar hits
onkeyup = onkeydown = function(d) {
o[0][0] = d.type[5] ? 1 : -1
},
// function to handle graphing
A = function(d, b, g, e , w) {
with (a)
e+1 && (fillStyle = '#'+'0ff0f009000fff'.substr(e , 3)),
w ? fillText( g , d , b ) :
(beginPath(), arc(d, b, g, q, 0, 0), fill());
return A
},
// draw our hippos
C = function(d, b, g, e, w) {
// make sure we are within our bounds
z < (b+=d) ? b = z : 0 > b && (b = 0);
// stop the hippo if at the bounds
b % z || (d = b && j ? -1 : 0 );
// set the movement
for (u = 0, k = 8 * b - f,
V = function( Z , M , U , G , D ){
A( f + g * ( k + M ) - ( g || Z ) , f + e * ( k + M ) - ( e || Z ) , U , G , D )
return V
};
// iterate through balls
n = l[u++]; )
// check if eaten
if (1 ^ n)
with ( n )
// draw if first time through
j || (
// get acceleration
v = F < s( P(x-f,2) + P(y-f,2) ) ? -.15 : .4,
// get velocity and position
x += X += v/2 * (x > f ? 1 : -1) - 1e-4,
y += Y += v/2 * (y > f ? 1 : -1),
// draw ball
A(x, y, z, 11)
),
// check if we have eaten the ball!
s( P(x - f - g * ( k + E ) , 2 ) + P(y - f - e * ( k + E ) , 2 ) ) < F-T &&
// bump
(~d ? (X=g*3*d||X) && (Y=e*3*d||Y) :
// eat
S++ && (1 ^ n && w++, l[u - 1] = 1));
// draw the score
A( T+j*E , E , w , j , 1 );
// draw our hippo
V( 0, E , F+b/3 ) ( 0 , z , E )
// draw the eyes
( z , F , T+b/3 , 11 )
( -z , F , T+b/3 )
( z , 44 , 5 , 8 )
( -z , 44 , 5 )
return arguments
}; --j + 1; )
// generate balls
l.push({x: N + f * r(),y: N + f * r(),X: 0,Y: 0}) &&
// generate hippos
4 > j && o.push([0, 0, j && 2 - j, 3 - j && 1 - j, 0]);
setInterval(function() {
// draw board
A(f, f, W, 7)(f, f, f, 4);
// iterate through hippos and update
for (j = 0, I = 0|r()*N; i = o[j];j++)
o[j] = C.apply(c, i);
// randomly make an AI hippo bite
o[++I] && S <= z && (o[I][0] = 1)
}, z)