public void GenerateTerrain(double rockChance) { for (int w = Margin.X; w < Margin.X + GameWidth * 2; w++) { for (int h = Margin.Y; h < Margin.Y + GameHeight; h++) { if (w == Margin.X || w == Margin.X + GameWidth * 2 - 1 || h == Margin.Y || h == Margin.Y + GameHeight - 1) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.SetCursorPosition(w, h); Console.Write('W'); Console.ResetColor(); } else if (rand.NextDouble() < rockChance && (w % 2 == 0)) { Rock rock = new Rock(new Point(w, h)); Terrain.Add(rock); rock.Draw(); } else { Console.SetCursorPosition(w, h); Console.Write(' '); } } Console.WriteLine(); } }