예제 #1
0
        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();
        }
예제 #2
0
 public void ApplyMove(Move move, bool reverse)
 {
     Board.ApplyMove(move);
     MoveUpdated?.Invoke(move, reverse);
     BoardGrid.Children.Clear();
     BoardGrid.UpdateLayout();
     DrawBoard();
     BoardGrid.UpdateLayout();
 }