1

I have an alpha beta pruning exercise that states the following (dots and boxes):

Next, a strategy game is described:

  • Starting with an empty grid of dots, players (A and B) take turns, adding a single horizontal or vertical line between two unjoined adjacent dots.

  • A player who completes the fourth side of a 1×1 box earns one point and takes another turn.

  • The game ends when no more lines can be placed. The winner of the game is the player with the most points.

The question is:

How do I Define an ​evaluation function​ to be used by the algorithm? Assume that ​MAX ​plays with color ​player A

A guiding photo

Community
  • 1
  • 1
eneko valero
  • 457
  • 3
  • 14

1 Answers1

1

First thing you should do is to have the coordinates x,y of each point ( (0,0) (0,1) (0,2) ; (1,0) (1,1) (1,2) ; (2,0) (2,1) (2,2) )

Each player will have a list of the points that he linked with a bar , then the evaluation will be in that way , you will see all the linked points , for each point with a coordinates (a,b) you will see if there is 3 points with following conditions { (a,b) (a,b+1) (a+1,b) (a+1,b+1) } , if yes then a cube is created

Example :

The player MAX , created a link between (0,0) and (0,1) , between (0,0) and (1,0) , between (1,0) and (1,1) and between (0,1) and (1,1 ) , then all these points will be added to his list

Now let's take one point (0,0) and make the evaluation , for all elements in the list , if there exist 3 elements which satisfies the 3 conditions { (a,b+1) (a+1,b) (a+1,b+1) } then we can say that there is a created cube

Karam Mohamed
  • 843
  • 1
  • 7
  • 15