/
MinesweeperDemo.cs
53 lines (42 loc) · 1.57 KB
/
MinesweeperDemo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// <copyright file="MinesweeperDemo.cs" company="Telerik Academy">
// Telerik Academy - High Quality Code Team Project. Team Rhenium.
// </copyright>
namespace Minesweeper
{
using System;
/// <summary>
/// The entry point of the game.
/// </summary>
public class MinesweeperDemo
{
public static void Main(string[] args)
{
GameField gameField = new GameField(10,10);
char[,] playingField = gameField.Create();
char[,] bombsField = gameField.PlaceBombs();
int maxScore = (gameField.FieldCols * gameField.FieldCols) -
(gameField.FieldCols + gameField.FieldCols);
Engine engine = new Engine();
while (true)
{
if (Engine.IsNewGame)
{
playingField = gameField.Create();
bombsField = gameField.PlaceBombs();
Draw.GameLoad();
Draw.PlayingField(playingField);
}
Console.Write("Enter row and column: ");
string inputCommand = Console.ReadLine();
if (inputCommand == "exit")
{
break;
}
inputCommand = engine.ParseInputCommand(inputCommand, playingField);
engine.ExecuteCommand(inputCommand, gameField, playingField, bombsField, maxScore);
}
Console.WriteLine("Press any key to exit the game.");
Console.Read();
}
}
}