O | X | --------- | X | --------- | | Ocan be represented by the vector #(O X ? ? X ? ? ? O). Write a function, index, which takes a vector representing a tic-tac-toe board as its argument and returns an integer value which is unique to that board, i.e., no other board has the same value.
Click here to get Scheme code which plays tic-tac-toe using minimax game tree search. Except for the fact that there is no static evaluation function, this code is complete.
Write a static evaluation function, evaluate-board, for the game of tic-tac-toe. To work properly, it should satisfy the constraints described above, but the exact details are up to you. Test your static evaluation function and verify that the program plays correct tic-tac-toe (i.e., the program does not lose and will take advantage of any mistakes which you make).
Write a function memoize which will memoize any function which takes a tic-tac-toe board as an argument. Use it to create memoized versions of evaluate-board, empties, and best-move (you can call these evaluate-board-m, empties-m, and best-move-m). Change all references to the old functions in the code so that the program now calls the new memoized versions. Verify that the behavior of the program is exactly the same as before--only faster. Note the presence of the time command surrounding the best-move function. This will print the time needed to compute the best move. You can use it to verify the increase in speed.