Example #1
0
		} /*Mastermind*/
		#endregion constructors

		#region behavior
		internal Feedback checkAnswerAndGiveFeedbackFor(ColorSequence comboToCheck) {
			if (!answerIsAllowed(comboToCheck))
				throw new ArgumentException();

			Feedback fb = getSecretCombo().compareToColorsequence(comboToCheck);
			GameState.TurnHistory.Add(comboToCheck);
			GameState.FeedbackHistory.Add(fb);

			GameState.updateTurn();

			return fb;
		} /*checkAnswerAndGiveFeedbackFor*/
		} /*removeBadCombosFromGoodCombos*/

		public ColorSequence makeGuess(Feedback fb = null) {
			ColorSequence guess;
			if (fb == null) {
				Colors[] buffer = new Colors[GameState.NrOfPins];

				for (byte i = 0; i < buffer.Length; i++)
					buffer[i] = (Colors)i;

				guess = new ColorSequence(buffer);
			} else {
				GameState.FeedbackHistory.Add(fb);
				guess = getNextGuess(fb);
				GameState.updateTurn();
			}

			GameState.TurnHistory.Add(guess);

			return guess;
		} /*makeGuess*/