#### Archived

This topic is now archived and is closed to further replies.

# Minimax

This topic is 5964 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

As an educational experience I implemented a limited ply minimax game of Connect 4. I tried adding in alpha-beta pruning. It seems pretty simple and I don''t see how I made a mistake, but it seems to me that I must have. It plays differantly. Without changing the number of plys a correctly implemented alpha-beta pruning should result in the exact same choice in moves by the computer, right? Another question was about valuing the board at the ply limit. The method I use is to value each of the 54 ways you could get a "Connect 4" on a 6x6 board. If an opponents piece is in a line then the value is zero. Otherwise it is the number of your own pieces plus one. The value of the board is then the differance of its value for the computer and human. The computer plays fine so I don''t need a better way. Rather I''m wondering how else could you value the board? Finally where do I go from here? Obviously getting the alpha-beta pruning working is one thing to do, but what is a step up?

##### Share on other sites
yes, I think it should always see the tree the same as long as you make the same moves of course. Another way you could try to make a evaluation function would be to add up if slots to the left above and below or right above and below to see if there were any diagonals lined up. If you had three you would just win, but make some constants to weight the number and add them all up, and subtract the enemy''s total too. For instance
100*(3 in place) + 20*(2 in place) + 5(1 in place) - 99*(comp has 3 in place) - 20*(comp has 2 in place) + 5(c has 1 in place)

Then look for the slot with the highest absolute value. If the number was negative, the opponent is winning so do a blocking move, if positive connect more. I''ve never done this or anything so it''s just off the top of my head, but it should work

1. 1
Rutin
25
2. 2
3. 3
JoeJ
19
4. 4
5. 5

• 13
• 11
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631754
• Total Posts
3002102
×