public bool IsPlayable(int column, int line, bool isWhite) { Point movePos = new Point(column, line); currentPossibleMoves = LogicalB.GetPossibleMoves(logicalBoard.BoardArray, isWhite, BOARD_DIMENSIONS); return(currentPossibleMoves.Any(move => move.position.Equals(movePos))); }
public bool PlayMove(int column, int line, bool isWhite) { Point movePos = new Point(column, line); currentPossibleMoves = LogicalB.GetPossibleMoves(logicalBoard.BoardArray, isWhite, BOARD_DIMENSIONS); Move targetMove = currentPossibleMoves.Where(move => move.position.Equals(movePos)).FirstOrDefault(); if (targetMove != null) { PlayMove(targetMove); return(true); } return(false); }
public Tuple <int, int> GetNextMove(int[,] game, int level, bool whiteTurn) { logicalBoard.BoardArray = game; try { currentPossibleMoves = LogicalB.GetPossibleMoves(game, whiteTurn, BOARD_DIMENSIONS); Move move = OthelloMiniMax.GetMove(game, level, whiteTurn); if (move == null) { move = new Move(new Point(-1, -1), whiteTurn); } return(new Tuple <int, int>(move.position.X, move.position.Y)); } catch { return(new Tuple <int, int>(-1, -1)); } }
/// <summary> /// Get the possible moves for this board /// </summary> /// <returns>A list of move objects returned</returns> public List <Move> GetMoves() { return(LogicalB.GetPossibleMoves(Data, whitePlayer, new Size(Data.GetLength(0), Data.GetLength(1)))); }