Skip to content

5.3 Compile and play 2048 on ARM, MIPS and PowerPc64 within a minute

nongiach edited this page Jun 8, 2018 · 2 revisions

One minute to compile, run and play 2048 with an AI on ARM, MIPS and PowerPc64 cpu using qemu.

Alt Text

Controls

hjkl and wasd  Default movement keys
q              Quit the current game

2048 on ARM

$ git clone https://github.com/tiehuis/2048-cli
$ sudo pip3 install arm_now
$ sudo apt-get install gcc-arm-linux-gnueabihf
$ export CC=arm-linux-gnueabi-gcc-6
$ cd 2048-cli
$ make
$ arm_now start armv5-eabi --sync
press ctrl+] to kill qemu
Welcome to arm_now
buildroot login: root
# ./2048 -I
Score: 816
   Hi: 188
-----------------------------
|      |      |      |    2 |
|      |      |    2 |    8 |
|      |    4 |    8 |   16 |
|    2 |    8 |   16 |  128 |
-----------------------------

# ./2048 <= to play yourself

2048 on MIPS

$ git clone https://github.com/tiehuis/2048-cli
$ sudo pip3 install arm_now
$ apt search mips gcc
$ apt install gcc-mips-linux-gnu
$ export CC=mips-linux-gnu-gcc
$ cd 2048-cli
$ make
$ arm_now start mips32 --sync
press ctrl+] to kill qemu
Welcome to arm_now
buildroot login: root
# ./2048 -I
Score: 1008 (+8)
   Hi: 0
-----------------------------
|   16 |    4 |    2 |   16 |
|    8 |    2 |   32 |    8 |
|    4 |  128 |    8 |    4 |
|    2 |    4 |   16 |      |
-----------------------------

1008

2048 on PowerPc64

$ git clone https://github.com/tiehuis/2048-cli
$ sudo pip3 install arm_now
$ apt install gcc-6-powerpc64-linux-gnu
$ export CC=powerpc64-linux-gnu-gcc-6
$ cd 2048-cli
$ make
$ arm_now start powerpc64-power8 --sync
press ctrl+] to kill qemu
Welcome to arm_now
buildroot login: root
# ./2048
Score: 536 (+8)
   Hi: 0
-----------------------------
|    2 |    8 |    4 |    2 |
|    4 |    2 |   32 |    8 |
|    2 |   16 |   64 |    2 |
|   16 |    4 |    8 |      |
-----------------------------

Options

source: https://github.com/tiehuis/2048-cli

-h             Print the program usage.
-H             Print the current highscore.
-C             Disable color support (default).
-c             Enable color support if supported.
-a             Enable animations (default).
-A             Disable animations.
-i             Enable ai without displaying game.
-I             Enable ai and display game.
-r             Reset highscore. Will prompt user.
-s SIZE        Set the size of the playing field.
-b RATE        Set the rate at which blocks spawn per turn.