reset password
Author Message
rabbott
Posts: 1649
Posted 14:52 Oct 30, 2016 |

I have made a few additional changes to TicTacToe.

  • There is now a Type Player = Char, and Char has been replaced by Player throughout. This make the type Player a bit more abstract but has no real effect on the code.

 

  • The Game type now derives Eq. As the relevant chapter for the week says, this means that two Games are equal (==) if their parts are equal. We don't actually compare two Games, but this change was necessary for the next one.

 

  • Game is now defined as an instance of Ord. That means that Games have a compare function defined for them. (Previously the compare function used to compare Games was built into minimax, the only place two Games are compared.) This is the only tricky change. But you are not required to understand how it works yet -- just what it means to say: instance Ord Game. This change greatly simplifies the minimax code.
Last edited by rabbott at 14:54 Oct 30, 2016.