Exemplo n.º 1
0
 public FormMineField(MineField field)
 {
     InitializeComponent();
     if (field == null)
     {
         throw new ArgumentNullException("field");
     }
     this._MineField = field;
     this._Time = DateTime.Now;
 }
Exemplo n.º 2
0
        public void Should_Add_Random_Mines_And_Fields()
        {
            Dictionary<MinesColors, int> coloring = new Dictionary<MinesColors, int>();
            coloring.Add(MinesColors.Blue, 2);
            coloring.Add(MinesColors.Yellow, 1);
            MineField field = new MineField(3, 3, coloring);

            Assert.AreEqual(3, field.MinesCount);
            Assert.AreEqual(9, field.FieldsCount);
            Assert.AreEqual(coloring, field.MineColoring);
        }
        private void btnStartGame_Click(object sender, EventArgs e)
        {
            int width = (int)this.numericUpDown_FieldWidth.Value;
            int heigth = (int)this.numericUpDown_FieldHeight.Value;
            int redMines = (int)this.numericUpDown_RedMines.Value;
            int blueMines = (int)this.numericUpDown_BlueMines.Value;
            int yellowMines = (int)this.numericUpDown_YellowMines.Value;
            int greenMines = (int)this.numericUpDown_GreenMines.Value;

            Dictionary<MinesColors,int> coloring = new Dictionary<MinesColors,int>();
            coloring.Add(MinesColors.Red,redMines);
            coloring.Add(MinesColors.Blue,blueMines);
            coloring.Add(MinesColors.Yellow, yellowMines);
            coloring.Add(MinesColors.Green,greenMines);

            MineField mineField = new MineField(width, heigth, coloring);
            FormMineField field = new FormMineField(mineField);
            field.Show();
        }