🤖

Inside the BEDMAS AI — How the Computer Chooses Its Moves

How the AI Works

On every AI turn, the engine generates every possible valid equation from the AI's current rack tiles, then evaluates each one based on where it could be placed on the board. Each potential placement is scored: base answer + any bonus cells hit + complexity bonuses.

This is a computationally intensive process. For a rack of 7 tiles, the number of possible equations runs into the thousands when you account for different orderings, operators, and board positions. The engine uses pruning rules to eliminate clearly suboptimal candidates early, bringing the evaluation set down to a manageable size without sacrificing quality.

The Three Modes Explained

  • Easy: The AI generates valid moves but deliberately picks from the bottom 40% by score. It also introduces a 1–2 second artificial delay so it doesn't feel instant. Great for beginners who want to learn the game without being steamrolled.
  • Medium: The AI uses weighted random selection from the top moves. It's competitive — it will usually take a good move — but not perfectly optimal. Games feel balanced and winnable with solid play.
  • Hard: The AI always selects the single highest-scoring valid move, instantly. It also specifically looks for ×2 cell coverage. This is how the AI plays at its absolute best — expect to lose often until you've mastered the strategy.

Does the AI "Know" Your Tiles?

No. The AI only evaluates positions based on its own rack and the current board state. It doesn't look ahead at what tiles you hold or try to predict your next move. This is an intentional design decision — a fully informed lookahead AI would be essentially unbeatable and no fun to play against. The Hard AI is already challenging enough using only perfect play with its own tiles.

Why the AI Sometimes Passes

If the AI has no valid equations with its current rack and no swap is available, it passes. This is rare but can happen in the late game when the board is dense. Like a human player, the AI is constrained to the actual tiles it holds.

Future AI Development

We're exploring a future "Expert" mode that would implement limited lookahead — evaluating not just the current best move but also what board positions it opens up for future turns. This requires significantly more computation and may require async processing to avoid visible delay, but it's technically feasible and would provide a genuine challenge for the strongest players.

Ready to put these tips into practice?

▶ Play BEDMAS Now