A Perfect Information, Zero-sum game

Example

``````scala> import axle._
import axle._

scala> import axle.game._
import axle.game._

scala> import axle.game.ttt._
import axle.game.ttt._

scala> import Strategies._
import Strategies._

scala> val x = Player("X", "Player X")
x: axle.game.Player = Player(X,Player X)

scala> val o = Player("O", "Player O")
o: axle.game.Player = Player(O,Player O)

scala> val game = TicTacToe(3,
|   x, randomMove, prefixedDisplay("X")(println),
|   o, randomMove, prefixedDisplay("O")(println))
game: axle.game.ttt.TicTacToe = TicTacToe(3,Player(X,Player X),<function2>,<function1>,Player(O,Player O),<function2>,<function1>)

scala> play(game)
X>
X> Tic Tac Toe
X> Moves are numbers 1-9.
X> Board:         Movement Key:
X>  | |           1|2|3
X>  | |           4|5|6
X>  | |           7|8|9
O>
O> Tic Tac Toe
O> Moves are numbers 1-9.
O> Board:         Movement Key:
O>  | |           1|2|3
O>  | |           4|5|6
O>  | |           7|8|9
X> You put an X in the lower right.
X> Board:         Movement Key:
X>  | |           1|2|3
X>  | |           4|5|6
X>  | |X          7|8|9
O> Player X put an X in the lower right.
O> Board:         Movement Key:
O>  | |           1|2|3
O>  | |           4|5|6
O>  | |X          7|8|9
X> Player O put an O in the lower middle.
X> Board:         Movement Key:
X>  | |           1|2|3
X>  | |           4|5|6
X>  |O|X          7|8|9
O> You put an O in the lower middle.
O> Board:         Movement Key:
O>  | |           1|2|3
O>  | |           4|5|6
O>  |O|X          7|8|9
X> You put an X in the center right.
X> Board:         Movement Key:
X>  | |           1|2|3
X>  | |X          4|5|6
X>  |O|X          7|8|9
O> Player X put an X in the center right.
O> Board:         Movement Key:
O>  | |           1|2|3
O>  | |X          4|5|6
O>  |O|X          7|8|9
X> Player O put an O in the lower left.
X> Board:         Movement Key:
X>  | |           1|2|3
X>  | |X          4|5|6
X> O|O|X          7|8|9
O> You put an O in the lower left.
O> Board:         Movement Key:
O>  | |           1|2|3
O>  | |X          4|5|6
O> O|O|X          7|8|9
X> You put an X in the upper middle.
X> Board:         Movement Key:
X>  |X|           1|2|3
X>  | |X          4|5|6
X> O|O|X          7|8|9
O> Player X put an X in the upper middle.
O> Board:         Movement Key:
O>  |X|           1|2|3
O>  | |X          4|5|6
O> O|O|X          7|8|9
X> Player O put an O in the center.
X> Board:         Movement Key:
X>  |X|           1|2|3
X>  |O|X          4|5|6
X> O|O|X          7|8|9
O> You put an O in the center.
O> Board:         Movement Key:
O>  |X|           1|2|3
O>  |O|X          4|5|6
O> O|O|X          7|8|9
X> You put an X in the upper right.
X> Board:         Movement Key:
X>  |X|X          1|2|3
X>  |O|X          4|5|6
X> O|O|X          7|8|9
O> Player X put an X in the upper right.
O> Board:         Movement Key:
O>  |X|X          1|2|3
O>  |O|X          4|5|6
O> O|O|X          7|8|9
X>
X> Board:         Movement Key:
X>  |X|X          1|2|3
X>  |O|X          4|5|6
X> O|O|X          7|8|9
X> You beat Player O!
O>
O> Board:         Movement Key:
O>  |X|X          1|2|3
O>  |O|X          4|5|6
O> O|O|X          7|8|9
O> Player X beat You!
res0: axle.game.ttt.TicTacToeState = TicTacToeState(<function1>,[Lscala.Option;@4b66abb7,3)
``````