private void PerformMove(Move move)
 {
     LogMoveMove(CurrentMovingPlayer, move.FromFieldIndex, move.ToFieldIndex);
     CurrentBoard.GetField(move.FromFieldIndex).MoveTo(CurrentBoard.GetField(move.ToFieldIndex));
     MovesMade++;
     TogglePawnDeletingOrSwitchPlayer();
 }
Beispiel #2
0
        private void HandlePawnPlacing(int fieldIndex)
        {
            Field selectedField = CurrentBoard.GetField(fieldIndex);

            if (selectedField.Empty)
            {
                CurrentPlayerPlacePawn(fieldIndex);
                TogglePawnDeletingOrSwitchPlayer();
            }
        }
Beispiel #3
0
        public void HandlePawnRemoval(int fieldIndex)
        {
            Field field = CurrentBoard.GetField(fieldIndex);

            if (!field.Empty)
            {
                if (!field.BelongsTo(CurrentMovingPlayer))
                {
                    RemovePawn(field);
                }
            }
        }
Beispiel #4
0
        private void HandlePawnMoving(int fieldIndex)
        {
            Field        newField = CurrentBoard.GetField(fieldIndex);
            PlayerNumber selectedFieldPawnPlayer = newField.PawnPlayerNumber;

            if (selectedFieldPawnPlayer == CurrentMovingPlayer)
            {
                LastSelectedField = newField;
            }
            else if (LastSelectedField != null && newField.Empty)
            {
                if (CurrentPlayersPawnsLeft <= FLYING_PAWNS_NUMBER)
                {
                    HandleFlyingMove(newField);
                }
                else
                {
                    HandleNormalMove(newField);
                }
            }
        }
Beispiel #5
0
 private void RemovePawn(int index)
 {
     CurrentBoard.GetField(index).Reset();
 }