This document defines a heuristic function to evaluate positions in a Tic-Tac-Toe game. It defines 8 possible ways to win as rows, columns or diagonals. It also defines a heuristic evaluation array to score positions based on having 1, 2, or 3 pieces in a row. The evaluatePosition function takes the game board, loops through the 8 win conditions, counts pieces for each player, references the heuristic array to score that position, and returns the total score.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
429 views1 page
Heuristic Function For Tic-Tac-Toe Game
This document defines a heuristic function to evaluate positions in a Tic-Tac-Toe game. It defines 8 possible ways to win as rows, columns or diagonals. It also defines a heuristic evaluation array to score positions based on having 1, 2, or 3 pieces in a row. The evaluatePosition function takes the game board, loops through the 8 win conditions, counts pieces for each player, references the heuristic array to score that position, and returns the total score.