; As an example of game transcript annotated with some analysis, here ; is a game with the following evaluation function plaing O. (define (c4-eval-1 board current-player max-player) (let ((winner (c4-end? board))) (cond ((equal? winner max-player) 1000) ((equal? winner (other-player max-player)) -1000) ((equal? winner 'draw) 0) (else 0)))) ; Actually, it's hardly an evaluation procedure at all --- if no one ; won the game, the value is 0. Still, this can use the power of the ; (alpha-beta) minimax search to look ahead. It can avoid losing ; games within its look ahead, but if it loses beyond that horizon, it ; won't know which move to make. ; NOTE: that since your evaluation function is more sophisticated than ; this, your analysis should be commensurately "deeper" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; the above evaluation function is playing O +---------------+ 6| | 5| | 4| | 3| | 2| | 1| | +---------------+ 1 2 3 4 5 6 7 X plays in column 4. +---------------+ 6| | 5| | 4| | 3| | 2| | 1| X | +---------------+ 1 2 3 4 5 6 7 O plays in column 1. +---------------+ 6| | 5| | 4| | 3| | 2| | 1| O X | +---------------+ 1 2 3 4 5 6 7 X plays in column 5. +---------------+ 6| | 5| | 4| | 3| | 2| | 1| O X X | +---------------+ 1 2 3 4 5 6 7 O plays in column 3. ; it can now see that X wins in 4 moves if this ; "open two at both ends" is not blocked +---------------+ 6| | 5| | 4| | 3| | 2| | 1| O O X X | +---------------+ 1 2 3 4 5 6 7 X plays in column 6. +---------------+ 6| | 5| | 4| | 3| | 2| | 1| O O X X X | +---------------+ 1 2 3 4 5 6 7 O plays in column 7. +---------------+ 6| | 5| | 4| | 3| | 2| | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 5. +---------------+ 6| | 5| | 4| | 3| | 2| X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 1. ; all moves look the same because no one wins in 4 moves +---------------+ 6| | 5| | 4| | 3| | 2| O X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 4. +---------------+ 6| | 5| | 4| | 3| | 2| O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 1. +---------------+ 6| | 5| | 4| | 3| O | 2| O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 1. +---------------+ 6| | 5| | 4| X | 3| O | 2| O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 3. ; X now has a forced win, but it's more than 4 ; moves ahead. +---------------+ 6| | 5| | 4| X | 3| O | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 3. ; actually, this was not the right move +---------------+ 6| | 5| | 4| X | 3| O X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 3. ; because if X plays 4, then O cannot block at ; both 3 and 4. O at 4 is a better move, but ; from this evaluation function's perspective, ; moving at either 3 or 4 blocks the X at 4 ; forced win. However, I still have a forced ; win that is more than 4 moves ahead. +---------------+ 6| | 5| | 4| X O | 3| O X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 4. +---------------+ 6| | 5| | 4| X O | 3| O X X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 4. +---------------+ 6| | 5| | 4| X O O | 3| O X X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 5. +---------------+ 6| | 5| | 4| X O O | 3| O X X X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 O plays in column 1. ; because O loses either way (if O plays 5, then ; X plays 6 and can win with either 6 or 7) +---------------+ 6| | 5| O | 4| X O O | 3| O X X X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 X plays in column 5. +---------------+ 6| | 5| O | 4| X O O X | 3| O X X X | 2| O O X X | 1| O O X X X O | +---------------+ 1 2 3 4 5 6 7 Player X wins in 19 moves!