Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var grid = new Grid(width: 10, height: 10);

            Console.Write(Renderer.RenderGrid(grid));

            var coordinates = CoordinateReader.ReadLine(Console.ReadLine());
            var newGrid     = grid.Explore(coordinates);

            Console.Write(Renderer.RenderGrid(newGrid));

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var grid = Grid.Unexplored(20, 20, 100);

            grid.RandomiseMines();
            Console.Write(Renderer.RenderGrid(grid));
            bool gameWon = true;

            while (true)
            {
                var coordinates = CoordinateReader.ReadLine(Console.ReadLine());
                var newGrid     = grid.Explore(coordinates);
                Console.Write(Renderer.RenderGrid(newGrid));

                if (newGrid.MineFound())
                {
                    gameWon = false;
                    break;
                }

                if (newGrid.FullyExplored())
                {
                    break;
                }
            }
            if (gameWon)
            {
                Console.Write("Congratulations!!!\n");
            }
            else
            {
                Console.Write("Game Over!");
            }

            Console.ReadLine();
        }