private static string[] solve(i_bot bot, string answer, bool verbose) { List <string> guesses = new List <string>(); c_guess guess = null; while (!bot.solved()) { if (verbose) { bot.print_suggestions(); } guess = null; if (answer != null) { guess = new c_guess(bot.get_best_guess(), answer); } while (guess == null) { Console.Write("Input guess and result: "); try { string guess_input = Console.ReadLine(); guess = new c_guess(guess_input); } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" Error - unable to parse input"); Console.ResetColor(); } } guesses.Add(guess.to_string()); guess.write_line(verbose); bot.apply(guess); } if (!guess.is_solution()) { guesses.Add(bot.get_solution()); } if (verbose) { bot.print_solution(); } else { Console.WriteLine(); } return(guesses.ToArray()); }
public void apply(c_guess guess) { m_answers.apply(guess); m_hints.score_hints(m_answers); }
public void apply(c_guess guess) { m_possible_answers = m_possible_answers.apply(guess); }