Imagine learning a game just by playing it over and over and noticing what worked. That is exactly what the AI does.
For every situation in the game it learns a Q-value β a score for how good a particular move tends to be. If a move leads to a win the score goes up; if it leads to a loss the score goes down. At first the AI tries moves almost at random β it explores. The more it trains, the more it begins to exploit what it has learned, choosing the moves with the highest scores. The table on the right shows the score for each move in each situation.
0
You
0
AI
0
Games
π―
Press New game to begin.
AI thinking
Q-table β the AI's brain
Each row = number of sticks remaining. Each column = move. Green = good move, red = bad. Gold border = best move in that state.