📜 ⬆️ ⬇️

219-byte Tron game

In the IT world, there has recently been a tendency to strive to minimize the amount of source code, without losing functionality. So, a certain comrade Alokmenghrajani and his friends set out to write a game with a minimal amount of code. The idea was to write a game on the movie Tron, and in the end they got 219 bytes, which is quite good.
image

There are four rules:
1. Motorcycle always starts in the center.
2. Control is done with the keys 'i', 'j', 'k', 'l'
3. When the bike touches the field boundary, “game over” appears with your result.
4. You need to run in Chrome 17 version (although it also works in FF of the latest version)

Game sources:

<body id=b onkeyup=e=event onload=
z=c.getContext('2d');
z.fillRect(s=0,0,n=150,x=11325);
setInterval("
0<x%n
&x<n*n
&(z[x+=[1,-n,-1,n][e.which&3]]^=1)
?z.clearRect(x%n,x/n,1,1,s++)
:b.innerHTML='gameover:'+s
",9)
>



')

Source: https://habr.com/ru/post/140780/


All Articles