Skip to content
A python implementation of 1024/2048 with a stdin/stdout interface for creating competing bots
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A python implementation of 1024/2048 with a local socket interface for creating competing bots.


Use to launch the local unix socket interface to the game engine. You'll have to supply two arguments: the random seed (so all bots receive the same sequence if they perform the same actions), and the path to the executable of your bot. Your bot will receive the path to the unix socket as it's first and only argument. Read and write to this socket to interact with the game engine.

./ 123 ./

The unix socket will be located in /tmp/4096-game-identifier (the path is provided as an argument to the bot executable).


The client registers itself by providing a name of the client ("examplebot") and then a newline.


It will receive the initial state of the game board back, where the board ends with the line "== currentscore":

0 0 2 0
0 0 0 0
2 0 0 0
0 0 0 0
== 4

The client must respond with the action it wants to perform (the direction it want to merge the board in), where all commands are given as single letters indicating the direction. Valid directions are "l", "r", "u" and "d".


The server responds again with the changed game state, before waiting for input again:

0 0 0 0
4 0 0 0
0 0 0 0
2 0 2 0
== 8

The cycle continues until the board is no longer playable, where the server will respond with "FIN endscore":

FIN 450

This ends a game session, and the server prints out the score and the number of moves performed by the bot before exiting (and terminating the bot if it hasn't terminated by itself).


See the exampel bot implementation in the repository.


This project and all included files are licensed under the MIT license.

Something went wrong with that request. Please try again.