private List <GameState> GetFirstStageNextPossibleStates(PlayerNumber playerNumber) { PlayerNumber otherPlayerNumber = playerNumber == PlayerNumber.FirstPlayer ? PlayerNumber.SecondPlayer : PlayerNumber.FirstPlayer; List <GameState> gameStates = new List <GameState>(); List <Field> emptyFields = CurrentBoard.GetEmptyFields(); foreach (var emptyField in emptyFields) { GameState nextGameState = PawnPlacingGameStateFromThis(playerNumber, emptyField.FieldIndex); HashSet <Mill> millDifference = nextGameState.MillDifference(this); if (millDifference.Count == 0) { gameStates.Add(nextGameState); } else if (millDifference.Count == 1) { List <Field> otherPlayersFields = nextGameState.CurrentBoard.GetPlayerFields(otherPlayerNumber); foreach (var otherPlayerField in otherPlayersFields) { gameStates.Add(nextGameState.PawnRemovalGameStateFromThis(otherPlayerField.FieldIndex)); } } else { List <Field> otherPlayersFields = nextGameState.CurrentBoard.GetPlayerFields(otherPlayerNumber); for (int i = 0; i < otherPlayersFields.Count - 1; i++) { GameState firstRemovedPawnGameState = nextGameState.PawnRemovalGameStateFromThis(otherPlayersFields[i].FieldIndex); for (int j = i + 1; j < otherPlayersFields.Count; j++) { GameState secondRemovedPawnGameState = firstRemovedPawnGameState.PawnRemovalGameStateFromThis(otherPlayersFields[j].FieldIndex); } } } } return(gameStates); }