public Result(Pins i_PlayerGuess, Pins i_ComputerSequence) { this.m_PlayerGuess = i_PlayerGuess; int numOfAccurateGuess = 0; for (int i = 0; i < this.m_PlayerGuess.Sequence.Count; i++) { if (i_PlayerGuess.Sequence[i] == i_ComputerSequence.Sequence[i]) { this.r_ResultFeedback.Add(Utils.eResult.V); numOfAccurateGuess++; } else if (i_ComputerSequence.Sequence.Contains(i_PlayerGuess.Sequence[i])) { this.r_ResultFeedback.Add(Utils.eResult.X); } } this.r_ResultFeedback.Sort(); //checks if player succeeded to guess if (numOfAccurateGuess == Utils.k_NumberOfPins) { m_GameStatus = Utils.eGameStatus.Success; } }
public List <Utils.eResult> CreateGameMove(List <Utils.ePins> i_UserGuess) { Pins currentGuess = new Pins(i_UserGuess); Result currentFeedback = new Result(currentGuess, this.m_ComputerSequence); this.m_GameStatus = currentFeedback.Status; return(currentFeedback.PlayerMoveFeedback); }