Exemplo n.º 1
0
 private void StartGame()
 {
     this._field = new SpielFeld(this._field.X, this._field.Y, this._field.LebendeZellen);
     this.Timer1.Start();
     EnableControlsAtStartStop(true);
     EnableSizeability(false);
 }
Exemplo n.º 2
0
 public static IEnumerable <Zelle> Remove(this IEnumerable <Zelle> zelleSequence, Zelle zelle)
 {
     if (SpielFeld.ZelleExistiert(zelleSequence.ToArray(), zelle))
     {
         zelleSequence = zelleSequence.Where <Zelle>(z => z.X != zelle.X || z.Y != zelle.Y);
     }
     return(zelleSequence);
 }
Exemplo n.º 3
0
 private void ResetSpielfeldDefault(bool randomize)
 {
     if (!randomize)
     {
         this._field = new SpielFeld(this.ButtonGrid1.GridWidth, this.ButtonGrid1.GridHeight, MakeDefaultShape());
     }
     else
     {
         MakeRandomDistribution();
     }
     SetCellColors();
 }
Exemplo n.º 4
0
        private void MakeRandomDistribution()
        {
            Random rng = new Random();

            this._field = new SpielFeld(this._field.X, this._field.Y, new Zelle[0]);
            int randomCellCount = rng.Next(this.ButtonGrid1.GetGridButtonCount());

            for (int i = 0; i < randomCellCount; i++)
            {
                int randomX = rng.Next(1, this.ButtonGrid1.GridWidth + 1);
                int randomY = rng.Next(1, this.ButtonGrid1.GridHeight + 1);
                this._field.ZelleAendern(new Zelle(randomX, randomY), out _);
            }
            this._field = new SpielFeld(this._field.X, this._field.Y, this._field.LebendeZellen);
        }