Skip to content

Easy Level Bot AI Logic

emresen12 edited this page Apr 10, 2026 · 1 revision

Easy Level Bot AI Logic

This page explains how the easy_level_bot makes decisions. Instead of the deep "Minimax" strategy used by advanced AIs, this bot uses a simpler, faster Greedy Approach and a custom Scoring System.


1. How the Bot Thinks (Greedy Approach)

The bot doesn't move entirely at random, but it also doesn't plan far into the future. It only evaluates the present moment.

  • Only One Step Ahead (Depth 1) The bot simulates only one move into the future. It does not calculate future turns or how the opponent will respond.
  • Immediate Reward: It tests all possible empty cells on the board and picks the move that gives the highest score for that exact moment.
  • Tie-Breaker (Randomness): If multiple moves yield the same highest score, the bot randomly selects one from this list of "best moves" to avoid being completely predictable (IndexedRandom).

2. How the Bot Scores a Move

Because the bot can only see 1 move ahead, it uses a Score (Heuristic) system to evaluate the current state of the board and figure out who is winning.

A. Connecting Pieces (Clustering)

In the Game of Y, pieces are stronger when they are grouped together.

  • The bot looks at the 6 neighbors around every piece.
  • If a piece touches another piece of the same color, it gets +150 points.

B. Touching the Sides

The goal of the game is to connect all three sides of the triangle.

  • Side A, B, or C: If a piece touches a side, it gets +1000 points.
  • This encourages the bot to build paths that reach the edges.

C. Defense (Blocking the Player)

This easy-level bot is quite aggressive when it comes to stopping the opponent.

  • The bot calculates not only its own pieces but also how good your potential moves would be for you.
  • It gives blocking moves a higher priority (1.2x more value).
  • Result: Because of this penalty mechanism in the scoring system, the bot might prefer to block you from making a critical move rather than building its own path.

Technical Details

Component Logic
Search Depth Only 1 Turn
Decision Mechanism Calculates the score (evaluate_board). If a new best score is found, the list resets. If there's a tie, the move is added to the list and one is chosen randomly.
Virtual Board The bot uses board.clone() to test moves without changing the real game.

Clone this wiki locally