public int calculate(ChessBoard board, Eside side, int depth) { List <BasePiece> AIPieces = board.AI_Pieces; List <BasePiece> HumanPieces = board.HUMAN_Pieces; if (side == Eside.AI) { return(0 - pieceValueAndPosition(AIPieces, HumanPieces) - mobility(AIPieces, HumanPieces) - check(board) - checkmate(board, depth)); } else { return(0 + pieceValueAndPosition(AIPieces, HumanPieces) + mobility(AIPieces, HumanPieces) + check(board) + checkmate(board, depth)); } }
public void Castling(Eside side, bool is_left) { Sound_CTL.Current.PlaySound(Esound.CASTLING); _currentCell.SetPieces(null); if (side == Eside.AI) { if (is_left == true) { _currentCell = ChessBoard.Current.cells[3][7]; mousePos = _currentCell.transform.position; mousePos.z = -1; } else { _currentCell = ChessBoard.Current.cells[5][7]; mousePos = _currentCell.transform.position; mousePos.z = -1; } } else { if (is_left == true) { _currentCell = ChessBoard.Current.cells[3][0]; mousePos = _currentCell.transform.position; mousePos.z = -1; } else { _currentCell = ChessBoard.Current.cells[5][0]; mousePos = _currentCell.transform.position; mousePos.z = -1; } } _currentCell.SetPieces(this); }
public void checkmate(Eside winSide) { _gameState = Egame_state.END_GAME; txt.text = "CHECKMATE! " + "WinSide: " + winSide; }