HomeBlockchainAlgoNim: The first game on the Algorand's blockchain

AlgoNim: The first game on the Algorand’s blockchain

A very interesting project came to life this weekend: AlgoNim, a game entirely based on Algorand (ALGO), which runs completely on the layer 1 of this blockchain.

All the rules of the game are implemented through Algorand Smart Contracts; the pawns are represented by Algorand Standard Assets and the game actions are performed in turn by the players through Atomic Transfers directly on the blockchain.

How does the game work?

To understand this game we need to take a step back and understand the starting game, Nim, a mathematical strategy rebus for 2 players who decide the number of pawns of the various piles and the maximum number of pawns to be removed at each move. 

Players take turns in removing as many pawns as they like from one of the piles. Whoever collects the last pawn from the table wins the game. 

Since Nim is a mathematically solvable game, it is possible to calculate the strategy to determine the winner and which moves are the winning moves. Thus, it is preferable to challenge a human being and not a computer.

After having understood the rules of the game we now move on to AlgoNim, a cryptographic version of Nim that runs completely on the Layer 1 of the Algorand blockchain, famous for using the PPoS (Pure Proof of Stake) consensus protocol.

The use of the blockchain provides the certainty that no one can rig the game.

The technical features of AlgoNim

All this has been made possible thanks to the different functions that have been introduced in Algorand version 2.0 such as ASA (Algorand Standard Assets), which allow creating tokens on this blockchain; AT (Atomic Transfers) and ASC1 (Algorand Smart Contracts) which rely on the Algorand Python SDK and PyTeal.

In fact, thanks to the interaction of the SDK and PyTeal, the game writes and initializes both ASC1 TEALs and ASAs for each match.

The system requires only a handful of seconds and a small fee of 0.8 ALGO to cover the creation of the token, so a really impressive cost/speed ratio, even if compared to other blockchains.

Although the game itself is complete, it needs some elements to be launched, in fact AlgoNim is bootable via command line on Algorand node and so we can say that it’s a game designed by programmers for programmers. 

The graphics are intentionally vintage: old school ASCII art, for the very nostalgic.

The source code is completely open-source, allowing anyone to develop a front end web interface.

The game was created by an Italian, Cosimo Bassi, aka Cusma, who in his bio on Twitter calls himself a “curious Free Spirit Pirate, with Apulian roots, Brazilian heart and electric engineer’s mind” and for some months now he has been Algorand’s Developer Ambassador. 

Recently Bassi held an informative meetup dedicated to Algorand technology.

The future of gaming on blockchain

This version of AlgoNim is the primary one, already working, but there are already some planned additions expected in the future like:

  • Improving the strength of the betting Escrow;
  • Freezing match tokens for everyone except active players;
  • Destroying ASAs created at the end of each match;
  • Adding a scoring system in Scores Pool to reward winners;
  • Implementing the “Multi-heaps” variant
  • Implementing the championship (best of 3 matches).
Alfredo de Candia
Alfredo de Candia
Android developer for over 8 years with a dozen of developed apps, Alfredo at age 21 has climbed Mount Fuji following the saying: "He who climbs Mount Fuji once in his life is a wise man, who climbs him twice is a Crazy". Among his app we find a Japanese database, a spam and virus database, the most complete database on Anime and Manga series birthdays and a shitcoin database. Sunday Miner, Alfredo has a passion for crypto and is a fan of EOS.
RELATED ARTICLES

MOST POPULARS

GoldBrick