Skip to content

Tic-Tac-Toe: Minimax fails to choose winning move in specific sequenc #1

@loftyyyy

Description

@loftyyyy

Web version: https://loftyyyy.github.io/TicTacWeb/

Description
When playing the following move sequence:

1 → 3 → 9 → 8

the minimax algorithm incorrectly blocks instead of winning.
Specifically, it places its move on cell 7 instead of cell 4, which would result in an immediate win.

Expected Behavior
The AI should recognize the winning opportunity and place its move on cell 4 to win the game.

Actual Behavior
The AI chooses cell 7, blocking the opponent rather than taking the win.

Steps to Reproduce

  1. Start a new Tic-Tac-Toe game.

  2. Play the following sequence of moves:

    • Player: 1
    • AI: (auto)
    • Player: 3
    • AI: (auto)
    • Player: 9
    • AI: (auto)
    • Player: 8
  3. Observe that the AI selects cell 7 instead of the winning cell 4.

Possible Cause

  • The evaluation or scoring function might be prioritizing blocking moves over winning moves.
  • The minimax recursion may not properly return the highest evaluated score for immediate wins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions