z=" h(){wi(a){b.styK.backgrX=;c.wYc.height=;O\"#fff\";703.5,0.5QO\"#0c0\";&R,&)QT,96B@16lUeWY3;(0;d<8a.d?:\"red\"movG0(lUG)BP/48((O ))(eT)/(P*)g=d+9;d<gd*P*TT+e,&-2R64,2,64-64,,16!d+\"π\",8R52Q-,288,,224A(O)+423E4[Z_ f.to_StrUg(font=\"bold 24px Lucida ConsoK\"Weaer [\"cVlwarmhot\"][M.mU(AetMon()/2-.52)], Heal [\"JpVrJgVd\"][A()/-1E9)%4],ZFVd (P*1E5@).toFixed(0)+\" pXs Next landmark (P@%P,\"MiKs traveKd (e/].map((d,g){!\" \"+dR608,0+*g)}++e}}h(M=Ma,P=M.PI,e=\"3/14/1848\"Qsout(\"setInterval(h,99)\",1500)";for(y in x="_DateZ Yid=XoundVooUinT-R,-Q)OKleJfairGeTo(;++d)BrotAf.g@-e/&128!Text(\"#c90\"for(d=704thf=new D,2*P,0)arc(functionsave(),etTime\"#000\"\",\"0,translRect(32);M.floor(restore( : \"+beginPath(ate().toFixed(2)+\" miles\"\" fillstrokeStyle=".split(""))z=z.replace(RegExp(x[y][0],"g"),x[y].slice(1));eval(z)
// http://en.wikipedia.org/wiki/Pi_Day
var xpos = 0, d = new Date('3/14/1848');
function clear() {
b.style.background = 'black';
c.width = c.height = 704;
a.fillStyle = 'white';
a.strokeStyle = 'white';
a.translate(703.5, 0.5);
}
function grass() {
a.save();
a.fillStyle = '#0c0';
a.fillRect(0, 128, -704, 128);
a.restore();
}
function circle() {
a.save();
a.translate(-32, 96);
a.rotate(-xpos / 16);
a.beginPath();
a.arc(0, 0, 32, 0, 2 * Math.PI, false);
a.lineWidth = 3;
a.strokeStyle = '#c90';
a.stroke();
for(var i = 0; i < 8; ++i) { // Spokes
if(i == 0) {
a.strokeStyle = 'red';
} else {
a.strokeStyle = '#c90';
}
a.beginPath();
a.moveTo(0, 0);
a.lineTo(0, 32);
a.stroke();
a.rotate(Math.PI / 4);
}
a.beginPath();
a.arc(0, 0, 8, 0, 2 * Math.PI, false);
a.fillStyle = 'black';
a.fill();
a.stroke();
a.restore();
}
function landmarks() {
// draw only visible landmarks
var min = Math.floor((xpos - 32) / (Math.PI * 32)), max = min + 9;
for(var i = min, j = 0; i < max; ++i) {
a.save();
a.translate(i * Math.PI * -32 - 32 + xpos, 128);
a.fillRect(-2, -64, 2, 64);
a.strokeRect(0, -64, 32, 16);
a.fillText(i + 'π', 8, -52);
a.restore();
}
}
function status() {
a.fillRect(-704, 288, 704, 224);
a.fillStyle = 'black';
d = new Date(d.getTime() + 4230000);
a.font = "bold 24px Lucida Console";
[' Date: ' + d.toDateString(), // Tue Mar 14 1848
' Weather: ' + 'coolwarmhot'.substr(Math.min(Math.floor(d.getMonth() / 2 - 0.5) * 4, 8), 4),
' Health: ' + 'goodfairpoorfair'.substr(Math.floor(d.getTime() / 1e9) % 4 * 4, 4),
' Food: ' + (Math.PI * 100000 - xpos / 32).toFixed(0) + ' pounds', // 314159 pounds
' Next landmark: ' + (Math.PI - (xpos / 32) % Math.PI).toFixed(2) + ' miles', // 3.14 miles
'Miles traveled: ' + (xpos / 32).toFixed(2) + ' miles'].map(function(v, i) {
a.fillText(' ' + v, -704, 320 + 32 * i);
});
}
function animate() {
clear();
grass();
circle();
landmarks();
status();
++xpos;
}
animate(); // Keep 314159 on screen for some time
setTimeout(function() {
setInterval(animate, 100);
}, 1500);