private static bool IsAbleToJumpRight(CheckersPiece piece, AllCheckerPieces allPieces) { bool canJumpRight = false; int[,] takenSquares = allPieces.GetTakenSquares(); bool isWhite = piece.IsWhite(); int row = piece.GetPosition()[0]; int column = piece.GetPosition()[1]; if (column == 7) { return(canJumpRight); } else if (isWhite && takenSquares[row - 1, column + 1] != 0) { return(canJumpRight); } else if (!isWhite && takenSquares[row + 1, column + 1] != 0) { return(canJumpRight); } else { return(!canJumpRight); } }
private static bool IsAbleToEatLeft(CheckersPiece piece, AllCheckerPieces allPieces) { bool canEatLeft = false; int[,] takenSquares = allPieces.GetTakenSquares(); bool isWhite = piece.IsWhite(); int row = piece.GetPosition()[0]; int column = piece.GetPosition()[1]; if (column == 0 || column == 1) { return(canEatLeft); } return(false); }
public void AddPiece(CheckersPiece piece) { checkersPieces.Add(piece); int[] pos = piece.GetPosition(); if (piece.IsWhite()) { takenSquares[pos[0], pos[1]] = 1; } else { takenSquares[pos[0], pos[1]] = 2; } }