I'm going through the Reversi tutorial and stuck on the following:
Since bSingleValue is true, the result should only contain the third column. So in the above, it's just a single column db with player?
The code is then used as follows:
How is [ $x ][ $y ] being used to find the player value if the result of getBoard() only contains the third column? It all makes sense to me except for the second arg for getDoubleKeyCollectionFromDb().
Code: Select all
// Get the complete board with a double associative array
function getBoard()
{
return self::getDoubleKeyCollectionFromDB( "SELECT board_x x, board_y y, board_player player
FROM board", true );
}
The code is then used as follows:
Code: Select all
if( $board[ $x ][ $y ] === null ) // If there is already a disc on this place, this can't be a valid move