public Minesweep(Game form, int difficulty, int customWidth, int customHeight, int customBombs) { gameForm = form; Instance = this; firstClick = true; finished = false; int gridX = 16, gridY = gridX; int bombAmount = 10; switch (difficulty) { case (int)Difficulty.Beginner: gridX = 9; gridY = 9; bombAmount = 10; break; case (int)Difficulty.Intermediate: gridX = 16; gridY = 16; bombAmount = 40; break; case (int)Difficulty.Advanced: gridX = 16; gridY = 17; bombAmount = 70; break; case (int)Difficulty.Custom: gridX = customWidth; gridY = customHeight; bombAmount = customBombs; break; default: gridX = 9; gridY = 9; bombAmount = 10; break; } InitGameGrid(gridX, gridY); // Resize buttons if grid is too big if (gameForm.boardPanel.Top < (3 + gameForm.smileBtn.Size.Height)) { gameForm.smileBtn.Size = new Size(26, 26); gameForm.smileBtn.Left = 107; gameForm.flagBtn.Size = new Size(26, 26); gameForm.flagBtn.Left = 208; } this.bombs = bombAmount; AddBombs(bombAmount); this.emptyLeft = 0; DetermineEmptyLeft(); gameForm.debugLabel.Text = this.bombs.ToString(); }
public Game(int difficulty, int width, int height, int bombs) { InitializeComponent(); boardPanel = this.gamePanel; debugLabel = this.label1; smileBtn = this.smileButton; flagBtn = this.flagButton; smileImg = smileBtn.Image; mineRef = new Minesweep(this, difficulty, width, height, bombs); }