forked from donno2048/snake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.py
49 lines (32 loc) · 1.07 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from re import findall
README = '''# Snake
This is a snake game in assembly made for DOSBox and Linux.
You can view the online [Demo](https://donno2048.github.io/snake/) (Use your arrow keys on pc or swipe on mobile).
Inspired by [Can you fit a whole game into a QR code?](https://youtu.be/ExwqNreocpg)
It was made in order to create the smallest "fun" game possible.
To build and run it use:
```sh
sudo apt update
sudo apt install dosbox nasm -y
git clone https://github.com/donno2048/snake
cd snake
nasm snake.asm -o snake.com -f bin
dosbox -c "cycles 1" -c "mount c ." -c "c:" -c "snake"
```
It is so small I could fit it into a single QR:
<img src="./snake.png" width="250"/>
It's `%i` bytes.
<details>
<summary>Hex</summary>
<br/>
```
%s
```
</details>
'''
hexdata = open("snake.hex").read().replace("\n", "")
length = len(hexdata)
for div in range(int(length ** .5), 0, -1):
if not length % div:
break
open("README.md", "w").write(README % (length // 2, "\n".join(findall('.' * (length // div), hexdata))))