Hacker's Handbook


Taba the story

Posted: 2023-06-01
The Taba game on a chess board.

In 2017, we embarked on a journey to build a blockchain named Aeternity. We used Erlang and developed a virtual machine called Fate, along with a programming language named Sophia.

You can read more about Fate in another post.

As a fun application to test on the chain, we built a game contract.

The idea was that the game begins when a player calls the start function in the contract. Other players have until height H+1000 to place a bet. At height H+1001, players can call the contract to get a seed from the H+1000 block hash. Players can then view the game in their app, solve it, and push the number of moves and a hash of the solution to the contract. At height H+2000, a player can claim the winnings by sending in their solution. The player who first produced the shortest correct solutions wins and gets the tokens.

But since this was a bit too close to gambling we decided to never publish the contract or the game.

Instead we rewrote the game in Erlang and JavaScript. We used some fantastic creative commons graphics to enhance the game's visual appeal in this version.

The Taba game with not so nice graphiscs.

For the Erlang server we used the Cowboy webserver with a worker pool.Each worker handles one request. For single-player mode, we used a REST API and serialized through the database. For multiplayer mode, we used a WebSocket API and serialized in a gen_server (1/game) with state backed to the database.

Then we developed a solver in C to find solutions for the puzzles. The solver is capable of finding the optimal solution. We use this to calculate the difficulty of the puzzle.

Our designer, Johannes, created more appealing graphics for the game, and we rewrote the frontend in Dart and Flutter. Puzzles are generated using a pseudo-random number generator implemented in all involved languages (Erlang, JavaScript, Dart, Java).

The Taba game with better graphiscs.

The game is very easy to pick up and play. It is available for download for free on the App Store and Google Play. The current version of the game boasts over 19 quintillions of puzzles to solve, with new features being added regularly.

The Taba game with nice graphiscs.

The game is hosted at Taba Quest where you can read more about it.

Or you can just download it, but don't blame me if all your free time suddenly is gone.

- Happi


Happi Hacking AB
Munkbrogatan 2, 5 tr
111 27 Stockholm