public List <PieceData> GetAllPiecesListOfColor(EChessTeam team) { switch (team) { case EChessTeam.White: return(GetAllWhitePieceslist()); case EChessTeam.Black: return(GetAllBlackPiecesList()); default: throw new ArgumentException("team: ", team.ToString(), null); } }
public BitBoardIndex EPieceTypeToBitBoardIndex(EPieceType piece, EChessTeam team) { if (team == EChessTeam.None) { throw new ArgumentException("team", team.ToString()); } string s_team = (team == EChessTeam.White) ? "WHITE_" : "BLACK_"; s_team += piece.ToString(); return((BitBoardIndex)Enum.Parse(typeof(BitBoardIndex), s_team.ToUpper(), true)); }
public PieceData GetPieceFromPos(int pos, EChessTeam team) { switch (team) { case EChessTeam.White: return(GetWhitePieceFromPos(pos)); case EChessTeam.Black: return(GetBlackPieceFromPos(pos)); case EChessTeam.None: return(new PieceData(EPieceType.None, EChessTeam.None, pos)); default: throw new ArgumentException("team", team.ToString(), null); } }
public int Evaluate(EChessTeam team) { if (team == EChessTeam.None) { throw new ArgumentException("team: ", team.ToString(), null); } int score; int otherTeamScore; List <PieceData> currentTeamData = GetAllPiecesListOfColor(team); EvaluateTeam(currentTeamData, out score); EChessTeam otherTeam = (team == EChessTeam.White) ? EChessTeam.Black : EChessTeam.White; List <PieceData> otherTeamData = GetAllPiecesListOfColor(otherTeam); EvaluateTeam(otherTeamData, out otherTeamScore); int tmpScore = 189 - otherTeamScore; return(score + Mathf.Abs(tmpScore)); }