public void GameInstantiatesWithPlayerStartingAt01() { var gameToTest = GenerateGame.GenerateAGame(8, 8, 5, 5, 0, 1); Assert.AreEqual(0, gameToTest.Player.CurrentPosition.Horizontal); Assert.AreEqual(1, gameToTest.Player.CurrentPosition.Vertical); }
void Start() { instance = this; boardSize = 8; rows = Mathf.RoundToInt((float)boardSize / 3); createBoard(8); pieces = GlobalVariables.instance.getPiece(); }
public void GameContinues() { var gameToTest = GenerateGame.GenerateAGame(8, 8, 5, 3, 0, 1); var dummyEvent = new PlayerEvents { GameOver = false }; gameToTest.HandlePlayerEvent(this, dummyEvent); Assert.AreEqual(false, gameToTest.GameOver); }
public void GameStopsOnGameOver() { var gameToTest = GenerateGame.GenerateAGame(8, 8, 5, 3, 0, 1); var dummyEvent = new PlayerEvents { GameOver = true }; gameToTest.HandlePlayerEvent(this, dummyEvent); Assert.AreEqual(true, gameToTest.GameOver); }
//create singleton of class void Awake() { if (GenerateGameSingle == null) { //DontDestroyOnLoad(gameObject); GenerateGameSingle = this; } else if (GenerateGameSingle != this) { Destroy(gameObject); } }
static void Main(string[] args) { Console.WriteLine("Welcome to Minesweeper"); Console.WriteLine("Use the arrow keys only to navigate and esc to quit"); //Create the Game var theGame = GenerateGame.GenerateAGame(8, 8, 50, 3, 0, 1); Console.WriteLine("You are on " + theGame.Board.HorizontalArray.Length.ToString() + "x" + theGame.Board.VerticalAxis.ToString() + " board starting from " + theGame.Board.HorizontalArray[theGame.Player.CurrentPosition.Horizontal] + theGame.Player.CurrentPosition.Vertical.ToString()); Console.WriteLine("Good luck!"); Console.WriteLine("Oh and there are " + theGame.Board.NumberOfMines.ToString() + " mines"); while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape)) { var input = Console.ReadKey(); //Check for Game Over if (theGame.GameOver) { Console.WriteLine("Game Over"); break; } if (input.Key == ConsoleKey.UpArrow || input.Key == ConsoleKey.DownArrow || input.Key == ConsoleKey.LeftArrow || input.Key == ConsoleKey.RightArrow) { theGame.Player.ProcessKeyStroke(input.Key.ToString()); } else if (input.Key == ConsoleKey.Escape) { break; } else { Console.WriteLine("Invalid key"); } } }
public void GameInstantiatesWithAPlayer3Lives() { var gameToTest = GenerateGame.GenerateAGame(8, 8, 5, 3, 0, 1); Assert.AreEqual(3, gameToTest.Player.NoOfLives); }
public void GameInstantiatesWith30Mines() { var gameToTest = GenerateGame.GenerateAGame(8, 8, 30, 5, 0, 1); Assert.AreEqual(30, gameToTest.Board.NumberOfMines); }
// Use this for initialization void Awake() { instance = this; }