This is how the backend of our nummi bot works

This is how the backend of our nummi bot works - Our colleague Floris explains how we built the nummi bot.

September 18, 2025

There are times when you simply want to start playing a game of nummi without having to wait for your opponent. That’s why we introduced our Granny bot about half a year ago. In this blog, our backend developer Floris gives you a deep dive into the algorithmic design of the bot with some thoughts and decisions that we’ve made along the way.

The basics: Heuristics and phases

“Granny version 1 was built by our backend colleagues Isa and Tom and is based on a few key playing principles that are easy to understand. We call these “heuristics,” which, according to the Oxford dictionary, are defined as ‘a method of solving problems by finding practical ways of dealing with them, learning from past experience.’

The bot is divided into two parts: the ‘meld’ phase and the ‘playing’ phase. In the meld phase, the objective is to lay down tiles with a minimum point requirement of 30, while in the playing phase, the goal is simply to find a move.

During the meld phase, we are not allowed to use any of the opponent’s tiles, so the bot only looks for possible rows and series. In the playing phase, however, heuristics come into play. The bot may try to replace jokers on the board with tiles from its rack, split and extend lines, or attempt possible series or rows.”

Improving the bot

“The newest version of the bot is more robust, calculating a larger set of moves. It cannot be classified at the level of a deep neural network with reinforcement learning, but it now finds combinations of moves that aim to gain the highest reward. Our goal is a ‘greedy’ reward, which means finding the set of actions that plays the most tiles from the rack. This is not always optimal, but it works well for the improved version.

The new actions are defined as ‘take’ (taking a line from the board onto the rack), ‘series’ (laying down a series from the rack onto the board), and ‘row’ (laying down a row). The bot naively searches through all combinations of these actions to find the maximum greedy reward.”

Optimizing performance

“Searching all possible combinations could be very slow. To address this, we applied several optimizations commonly used in search trees. To limit the number of combinations, we prune branches of the search tree. One method is ‘memoization,’ which involves remembering the combination states the bot has already gone through. For example, ‘row’ > ‘series’ > ‘series’ might be the same as ‘series’ > ‘series’ > ‘row.’ Another method is introducing a ‘maximum depth’ hyperparameter to limit how many times the bot can take a line from the board.

We also optimized the algorithms for computing possible series and rows. For example, Granny version 1 sometimes missed combinations involving jokers, which could prevent it from winning in cases where ‘blue 1,’ ‘red 1,’ ‘yellow 1,’ and ‘joker’ would have won in a single move.”

Testing and results

“When implementing and testing bots, we use a bot fight! The results were well-received, with bot version 2 winning 55 to 15 against version 1, achieving a win rate of about 80%.”

Enhancing user experience

“We also focused on providing a smooth user experience. For example, if the bot takes multiple lines from the board and places them back, where did the tiles come from? The coordinates of all actions are now saved to ensure the user does not see the board change completely after every bot move.

Since the bot considers all possible options naively, it also has a limited thinking time, adjustable as a hyperparameter. Users want fast games instead of waiting 20 minutes, although a slow-thinking bot might be interesting to play against as well.”

In any case, we have found yet a new way to challenge users who are looking for a friendly mechanical granny to play. And we’re very proud of it!”

Enrich your life.

Experience the difference with our intelligent solutions. Get in touch today and discover how we can enrich your digital world.