2011年4月22日 星期五

ChessStatus Class

This is the partial PHP 5 ChessStatus class

class ChessStatus {
 ...
 public $ROWS = array(); //10 rows on the chess board
 public $ALLOWEDCOLOR = 0;
 public $MOVENUMBER = 1;

 public $redReachableCells = array();

 public $redAllowedCells = array();

 public $greenReachableCells = array();
 public $greenAllowedCells = array();

 ...
 function __construct()
 {
  for( $n=0; $n<=9; $n++ )
  { $this->ROWS[$n] = '+++++++++';
  }
 }
 ...
}


The most important member is $ROWS, $ALLOWEDCOLOR and $MOVENUMBER are respectively the  description of chessboard layout ,which side to play and the move number to be.

0 個意見:

張貼留言

訂閱 張貼留言 [Atom]

<< 首頁