public ChessPosition( ChessPosition chessPos ) { this.posType = chessPos.posType; this.nRank = chessPos.nRank; this.nPile = chessPos.nPile; this.pos = chessPos.pos; }
public ChessPosition( int nPosRank, int nPosPile ) { this.posType = GetPositionType( nPosRank, nPosPile ); if( this.posType != BoardPositionType.eNone ) { this.nRank = nPosRank; this.nPile = nPosPile; this.pos = (BoardPosition)(nPosPile * ChessData.nNumRank + nPosRank); } else { this.nRank = -1; this.nPile = -1; this.pos = BoardPosition.InvalidPosition; } }
public ChessPosition( BoardPosition boardPos ) { int nPosRank = 0, nPosPile = 0; this.posType = ChessPosition.CalcPositionIndex( boardPos, ref nPosRank, ref nPosPile ); if( this.posType != BoardPositionType.eNone ) { this.nRank = nPosRank; this.nPile = nPosPile; this.pos = boardPos; } else { this.nRank = -1; this.nPile = -1; this.pos = BoardPosition.InvalidPosition; } }
public bool SetPosition( ChessPosition chessPos ) { this.posType = chessPos.posType; this.nRank = chessPos.nRank; this.nPile = chessPos.nPile; this.pos = chessPos.pos; if( chessPos.posType == BoardPositionType.eNone ) { return false; } return true; }
public bool MovePosition( int nRankMove, int nPileMove ) { int nMovedRank, nMovedPile; nMovedRank = nRank + nRankMove; nMovedPile = nPile + nPileMove; if( nMovedRank >= 0 && nMovedRank < ChessData.nNumRank && nMovedPile >= 0 && nMovedPile < ChessData.nNumPile ) { SetPosition( nMovedRank, nMovedPile); return true; } pos = BoardPosition.InvalidPosition; posType = BoardPositionType.eNone; nRank = -1; nPile = -1; return false; }
private bool OwlShouldStopHere(int position, BoardPositionType desiredColor) { return(position >= NestPosition || (desiredColor == Board[position] && !Owls.Inhabit(position))); }