List <Move> _GetMoves(PieceAI.playerColor color) { List <Move> turnMove = new List <Move>(); List <Tile> pieces = new List <Tile>(); if (color == PieceAI.playerColor.BLACK) { pieces = _blackPieces; } else { pieces = _whitePieces; } foreach (Tile tile in pieces) { MoveFactory factory = new MoveFactory(_board); List <Move> pieceMoves = factory.GetMoves(tile.CurrentPiece, tile.Position); foreach (Move move in pieceMoves) { Move newMove = _CreateMove(move.firstPosition, move.secondPosition); turnMove.Add(newMove); } } return(turnMove); }
public List <Move> GetMoves(PieceAI piece, Vector2 position) { _piece = piece; _type = piece.Type; _player = piece.Player; _position = position; foreach (KeyValuePair <PieceAI.pieceType, System.Action> p in pieceToFunction) { if (_type == p.Key) { p.Value.Invoke(); } } return(moves); }
public int GetBoardWeight(PieceAI.pieceType type, Vector2 position, PieceAI.playerColor color) { switch (type) { case PieceAI.pieceType.PAWN: if (color == PieceAI.playerColor.WHITE) { return(PawnBoardWeight[(int)position.x, (int)position.y]); } else { return(PawnMirrorBoardWeight[(int)position.x, (int)position.y]); } case PieceAI.pieceType.ROOK: if (color == PieceAI.playerColor.WHITE) { return(RookBoardWeight[(int)position.x, (int)position.y]); } else { return(RookMirrorBoardWeight[(int)position.x, (int)position.y]); } case PieceAI.pieceType.KNIGHT: if (color == PieceAI.playerColor.WHITE) { return(KnightBoardWeight[(int)position.x, (int)position.y]); } else { return(KnightMirrorBoardWeight[(int)position.x, (int)position.y]); } case PieceAI.pieceType.BISHOP: if (color == PieceAI.playerColor.WHITE) { return(BishopBoardWeight[(int)position.x, (int)position.y]); } else { return(BishopMirrowBoardWeight[(int)position.x, (int)position.y]); } case PieceAI.pieceType.QUEEN: if (color == PieceAI.playerColor.WHITE) { return(QueenBoardWeight[(int)position.x, (int)position.y]); } else { return(QueenMirrorBoardWeight[(int)position.x, (int)position.y]); } case PieceAI.pieceType.KING: if (color == PieceAI.playerColor.WHITE) { return(KingBoardWeight[(int)position.x, (int)position.y]); } else { return(KingMirrorBoardWeight[(int)position.x, (int)position.y]); } default: return(-1); } }