Game Principles & AI Logic

How DominoZnif works — from game rules to the AI brain that plays against you.

1. Game Principles

DominoZnif is the Israeli / Eastern-Mediterranean team variant of All Fives (Muggins). Four players, two teams of two, one goal: be the first team to reach 51 points.

Setup

Starting a Round

The Spinner (Znif)
The spinner sits in the centre and can be built in all four directions (Left, Right, Up, Down), forming a cross. However, Up and Down arms are locked until both Left and Right each have at least one tile.

Play

Scoring Per Move

After each tile is placed, sum the pip values at all open arm ends. If the total is a multiple of 5, the playing team scores total ÷ 5 points.

Special Spinner Rule
The central spinner counts its full double value in the open-end sum only while at least one of its Left or Right arms is still empty. Once both L and R have tiles, the spinner itself stops contributing — but other doubles on arm ends still count at full value.
Example — spinner [4|4]: Just placed, no arms → sum = 8 → not multiple of 5 → 0 pts After Left tile ending in 3, Right empty → 8+3 = 11 → 0 pts After Left 3, Right 4, Up 2, Down 1 → 3+4+2+1 = 10 (spinner no longer counts) → 2 pts

Round End

Game End

First team to reach 51 points wins. The current round still finishes. If both teams end a round at ≥ 51 with equal scores, play continues until one team strictly leads.

2. AI Architecture

The AI in DominoZnif is not random. Every move is calculated. Here is how it thinks.

Difficulty Levels & Rollouts

The AI has 9 difficulty levels. The higher the level, the more simulations it runs before choosing a move:

DifficultySimulations (N)Method
Novice0Single-ply heuristic only
Beginner200Heuristic-guided rollouts
Casual350Heuristic-guided rollouts
Average500Heuristic-guided rollouts
Skilled650Heuristic-guided rollouts
Sharp800Heuristic-guided rollouts
Expert950Heuristic-guided rollouts
Master1,100Heuristic-guided rollouts
Legend1,250Heuristic-guided rollouts

How Rollouts Work

For each possible move, the AI runs N simulations:

  • Clones the board and all players onto a scratch copy.
  • Randomly samples the opponents' unknown tiles (based only on what a real player could observe).
  • Plays the round to completion using the heuristic for all seats.
  • Records the score difference: my team − opponent team.
  • Averages the result over N simulations.

The move with the best average wins.

What the AI Is Allowed to See

The AI plays fair. It can only use information a real human player could observe:

It never peeks at opponents' hands. Unknown tiles are sampled randomly from a pool that excludes placed tiles and the AI's own hand.

3. How the Heuristic Evaluates a Move

For Novice difficulty, and as the evaluator inside every rollout simulation, the AI scores each legal move using a weighted sum of these factors:

FactorWhat it does
ScoreValRewards scoring points right now.
PrvOppPenalises leaving a big scoring opportunity for the next opponent.
BlkValRewards forcing the opponent to pass.
HvyDumpEncourages playing heavy doubles early — they hurt if you're stuck with them at round end.
SelfDomRewards keeping your dominant pip value playable on the board.
TeamDomSupports your partner's likely future plays based on inference.
ArmAlnLeaves open arm ends showing values you dominate.
Kill5Closes a 5-end before the opponent can score from it. (+60)
SelfDblSoft bonus for denying the opponent their strongest double reply. (+50)
BlkChainHard bonus when a move forces all three opponents to pass AND your team has lighter tiles. (+500)
NoReplyBonus when you score AND the opponent cannot reply: +100 if net gain ≥ 3, +200 if ≥ 5.

Endgame Awareness

When a team's score approaches 51, the AI adjusts: if a move scores points, it ignores the opponent-reply penalty and takes the points. Winning is more important than defensive positioning when the game is close.

4. Opening Move Shortcut

Before running any simulation, the AI checks for a dominant opening:

If all conditions are met, the AI immediately opens with [X|X] as the spinner — no simulation needed. This is the strongest possible opening position.