Magic SquaresTopMatrix and TicTacToe

Matrix and TicTacToe

Recall we introduced the type Matrix and the class matrix last time:

Type Matrix<T> is defined as follows:

type Matrix<T> = {
  at(r: Number, c: Number) -> T 
  at(r: Number, c: Number) put (value:T) -> Done
}

class matrix.size<T>(rows,cols) defaultValue (dValue) -> Matrix<T>

We showed last time how to use Matrix to play a game of tic-tac-toe


Magic SquaresTopMatrix and TicTacToe