Change all matrix arrays to Board instance

Change all matrix arrays to Board instance  and the corresponding
methods, The project can build now.
Merged File