Пример #1
0
        public void Go()
        {
            view.Clear();
            view.Send("Welcome to Sudoku!");
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            while (!game.IsFinished())
            {
                view.Send("The current board state is:");
                view.Send(game.ToString());
                string input       = view.Get("Enter the Value for the new cell and the 0 Based Index of the cell e.g. \"0,1\"");
                int[]  inputParsed = Array.ConvertAll(input.Split(","), s => int.Parse(s));
                int    value       = inputParsed[0];
                int    cell        = inputParsed[1];
                view.Clear();
                view.Send($"Parsed Command => Value: {value} and Cell: {cell}");
                view.Send(game.Play(value, cell));
                view.Send($"you are now {stopwatch.Elapsed.TotalSeconds} seconds through the game");
            }
            view.Send(game.ToString());
            view.Send("Congrats! you finished the maze :D");
            stopwatch.Stop();
            view.Send($"It took you {stopwatch.Elapsed.TotalSeconds} seconds to complete the Sudoku!");
            view.Finish();
        }