/// <summary> /// Initializes a new instance of the <see cref="Solver"/> class. /// </summary> /// <param name="keypad">The keypad to solve.</param> public Solver( Keypad keypad) { _keypad = keypad; // Tumblers array stores the indices of the current tumbler positions _tumblers = new int[keypad.CodeLength]; // Keep track of the number of codes tried _codesTried = 0; }
static void Main(string[] args) { // Create a new keypad Keypad keypad = new Keypad( 4, /* 4 buttons */ new List<char> { 'a', 'b', 'c', 'd', 'e', 'f' } /* Keypad symbols */); Solver solver = new Solver(keypad); /* Create a new solver */ solver.Solve(); Console.WriteLine("Press any key to exit."); Console.ReadLine(); }