public void NewGame5Test() { model.NewGame(5); Assert.AreEqual(5, model.TableSize); Assert.AreEqual(0, model.P1InTheHole); Assert.AreEqual(0, model.P2InTheHole); Assert.AreEqual(true, model.FirstsTurn); }
/// <summary> /// New game with a specified grid size /// </summary> /// <param name="size">The size of the new grid</param> public void NewGame(int size) { gridSize = size; buttonHeigth = gameField.Height / gridSize; buttonWidth = gameField.Width / gridSize; DeleteTable(); GenerateTable(size); model.NewGame(size); gridSize = size; turnPhaseOne = true; model.FirstsTurn = true; previousButton = null; }
public BlackHoleGame() { InitializeComponent(); grid = new List <GridButton>(); blackHole = new GridButton(this, 0, 0); previousButton = new GridButton(this, 0, 0); model = new BlackHoleModel(); model.GameOver += this.OnModel_gameOver; model.GameUpdated += this.OnModel_gameUpdated; toolStripMenuItem8.Click += SaveGame; toolStripMenuItem9.Click += LoadGame; turnPhaseOne = true; model.FirstsTurn = true; model.FieldChanged += this.OnModel_fieldChanged; gridSize = 9; model.NewGame(gridSize); formWidth = 500; formHeigth = 500 + menuStrip1.Height; gameField.Margin = new Padding(0, 0, 0, 0); gameField.Padding = new Padding(0, 0, 0, 0); this.Size = new Size(formWidth, formHeigth); buttonHeigth = gameField.Height / gridSize; buttonWidth = gameField.Width / gridSize; this.MaximumSize = this.Size; this.MinimumSize = this.MaximumSize; GenerateTable(gridSize); this.toolStripMenuItem3.Click += On_5x5newGame; this.toolStripMenuItem4.Click += On_7x7newGame; this.toolStripMenuItem5.Click += On_9x9newGame; }