While mining for gold coins, you've unfortunately slipped and you're now plummeting to your death. Grab as many coins as you can before you go splat.
for(_='+1~c.X;XfW00Ve(U[iR),QQXP,iPl(OR]N0>AN?KXfillJ=1HGH6VFonkeyDMath.=[0];0",Style=Pstroke++)=0;random()+H0*-5Xba(Pm(E0,5f:i+Y}J"#f1080);R~],i~Interval(.push(5b:i-Y,c:for( &&(2Vfunction.slicUYn.addColorStop(]OI5i,8,Y,4*B%360*3/,L)("# i in c)cR[0]+R[6]]]=cN;M=;F;E=[M];I=[G];AoHE3;kp=T=B=S=CYH2;L=6; Ub){ ii<b;i.01>SH5QM+C+S,G-C-S,>MM=Q16V<GFQG>MEMQIGQv=.99<?1:.5>v*=-1QAvQC+HE-6,S=0)}Ddown=Dup=(b){k[b.which]=b.type[5]};Ut=set(){n=XcL("#320"1,"#V0"nWc(192 i>i;iif(NOEPm(IRVR~099AN){var b=o,a=K{a:EN-8+EN~6+:{a:IN-8-IN~6-;a.a>o+48||a.c<b||248<a.b||>a.f?(fXba(QKXeUEN+:XeUIN-,J()):(AN=p}db";k[37]o-=Yk[39]o+=Yif(o<E[]-8||o>I[]-40)TH,0cleartb=T?"AAhgZhwYTgA=":15>B?"GBiBfhg8ZsM=":"GBhCfhg85wA="; a12>a;a var d8>d;datob(b).charCodeAt(a)&pow(2,d)&&Xfc(o+d*L,+a*L,L,L30==B++B=0ff"Wont="60px c"Wx(1E3*p,5E=EI=IA=AUY)},16';G=/[^ -CEGILMSTY-}]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
Zm9yKF89JysxfmMuWDtYZlcwMFZlKFVbaVIpLFFRWFAsaVBsKE9SXU4wPkFOP0tYZmlsbEo9MUhHSDZWRm9ua2V5RE1hdGguHz1bMF07HjAiLB1TdHlsZT0cUHN0cm9rZRsrKykaPTA7GR9yYW5kb20oKRgrSDAqGC01F1hiYShQbShFFjAsFTUVZjppK1l9FEocExMiI2YSMTA4MBEpOxBSfl0saX4PSW50ZXJ2YWwoDi5wdXNoKAw1F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aChfLnNwbGl0KEcpKV89am9pbihzaGlmdCgpKTtldmFsKF8p
/*
* Inheritance... by Jason "--jp" Plackey
* jp [at] chicagowebexperts [dot] com
*
* For JS1k 2018 - The Volatile Coin Mine
* Final packed entry size is 1023b.
*
* "There's gold in them thar hills!"
*
* While mining for gold coins, you've unfortunately
* slipped (or were you pushed?), and you're now
* plummeting to your death.
*
* You're gonna die, no doubt about it... so you
* might as well leave your widow a sizable
* inheritance! Grab as many coins as you can before
* you go splat.
*
*/
M = 200;
O = 1600;
N = [M];
P = [O];
$ = [0];
o = 1000;
k = [0];
K = 0;
U = 0;
F = 0;
T = 0;
p = 0;
V = 12;
L = 6;
function iR(M, O) {
return !(O.M > M.O || O.O < M.M || O.N > M.P || O.P < M.N);
}
function nP(c) {
for (i = 0; i < c; i++) {
if (Math.random() < 0.01) { U = 15; }
M += (Math.random() * 10) - 5 + K + U;
O += (Math.random() * 10) - 5 - K - U;
if (M < 200) M = 200;
if (O > 1600) O = 1600;
if (O > M) {
N.push(M);
P.push(O);
v = Math.random() > 0.99 ? 1 : 0;
if (Math.random() < 0.5) v *= -1;
$.push(v);
K += 1E-6;
U = 0;
}
}
}
function s(M, N) {
N = '';
M.forEach(e => { N += String.fromCharCode(e); });
return N;
}
function bmp() {
if (k[37]) { o -= V; }
if (k[39]) { o += V; }
if (o < N[200] - 8 || o > P[200] - 40) {
T = 1;
c.fillStyle = '#f00';
clearInterval(t);
}
var pattern = T ? 'AAhgZhwYTgA=' : (F < 15) ? 'GBiBfhg8ZsM=' : 'GBhCfhg85wA=';
for (var y = 0; y < 12; y++) {
for (var x = 0; x < 8; x++) {
var ch = atob(pattern).charCodeAt(y);
if (ch & (2 ** x)) {
c.fillRect(o + (x * L), 200 + (y * L), L, L);
}
}
}
if (F++ == 30) { F = 0; }
}
onkeydown = onkeyup = e => { k[e.which] = (e.type[5]); }
nP(1080);
t = setInterval(e => {
n = c.createLinearGradient(0, 0, 0, 1080);
n.addColorStop(0, '#320');
n.addColorStop(1, '#000');
c.fillStyle = n;
c.fillRect(0, 0, 1920, 1080);
for (i = 0; i < 1080; i++) {
c.beginPath();
c.moveTo(N[i], i);
c.lineTo(N[i + 1], i + 1)
c.moveTo(P[i], i);
c.lineTo(P[i + 1], i + 1)
c.stroke();
c.strokeStyle = '#000';
c.beginPath();
c.moveTo(N[i + 1], i);
c.lineTo(P[i + 1], i + 10);
c.stroke();
c.strokeStyle = '#990';
if ($[i]) {
var gr = { M: o, N: 200, O: o + 48, P: 248 };
if ($[i] < 0) {
var cr = { M: N[i] - 8 + 50, N: i - V, O: N[i] + 16 + 50, P: i + V };
} else {
var cr = { M: P[i] - 8 - 50, N: i - V, O: P[i] + 16 - 50, P: i + V };
}
if (iR(gr, cr)) {
$[i] = 0;
p++;
} else {
c.fillStyle = '#ff0';
c.beginPath();
($[i] < 0) ? (c.ellipse(N[i] + 50, i, 8, V, ((F * 4) % 360) * 3 / 200, 0, L)) :
(c.ellipse(P[i] - 50, i, 8, V, ((F * 4) % 360) * 3 / 200, 0, L));
c.fill();
}
}
}
c.fillStyle = '#fdb'; bmp();
c.fillStyle = '#fff';
c.font = '60px c';
c.fillText(p * 1000, 50, 200);
N = N.slice(V);
P = P.slice(V);
$ = $.slice(V);
nP(V);
}, 16);