private void MovePart2(Point p, bool reverse) { Move move; if (reverse) { move = new Move(p, _originMovePoint, _amazonMovePoint); if (!Board.GetAvailableReverseMovesForPreviousPlayer().Contains(move)) { throw new Exception($"Invalid reverse move: {move}"); } Board.ApplyReverseMove(move); } else { move = new Move(_originMovePoint, _amazonMovePoint, p); if (!Board.GetAvailableMovesForCurrentPlayer().Contains(move)) { throw new Exception($"Invalid move: {move}"); } Board.ApplyMove(move); } MoveUpdated?.Invoke(move, reverse); BoardGrid.Children.Clear(); BoardGrid.UpdateLayout(); DrawBoard(); BoardGrid.UpdateLayout(); }
public void ApplyMove(Move move, bool reverse) { Board.ApplyMove(move); MoveUpdated?.Invoke(move, reverse); BoardGrid.Children.Clear(); BoardGrid.UpdateLayout(); DrawBoard(); BoardGrid.UpdateLayout(); }