//obsolete //first version /did try to calculate system type during creation) private void createCircles() { int startingPropability = 20; int preventNewAsteroid = 1; for (int i = 1; i < maxCircles; i++) { //there are fewer planets near the sun - prevent planet 2 + 4 if (i == 2) { continue; } var Type = typeDetector.getPlanetType(i); if (this.StartSystem) { if (i > 11) { continue; } switch (Type) { case 9: case 10: case 11: case 12: createAsteroidCircle(i, (asteroidCircleTypes)(Type - 9)); AsteroidCirclesCount++; break; default: createPlanetCircle(i, Type); break; } } else { if (i == 4) { continue; } if (randomGenerator.Next(0, 100) < 5) { continue; //skip circle in 5% } int asteroidCirclePropability = startingPropability + (i * 3) - (preventNewAsteroid * 100) - (AsteroidCirclesCount * 30); //asteroid circle - three innerost circles are not permitted (init-Value of preventNewAsteroid does this if (randomGenerator.Next(0, 100) < asteroidCirclePropability) { AsteroidCirclesCount++; asteroidCircleTypes asteroidCircleType = (asteroidCircleTypes)randomGenerator.Next(0, 4); preventNewAsteroid = 3; // 1 + (int)asteroidCircleType; createAsteroidCircle(i, asteroidCircleType); if (showText && TextBox != null) { TextBox.Text += " Circle " + i + " Asteroid " + asteroidCircleType.ToString() + Environment.NewLine; } } else { if (showText && TextBox != null) { TextBox.Text += " Circle " + i + " Planet" + Environment.NewLine; } createPlanetCircle(i, Type); preventNewAsteroid = preventNewAsteroid > 0 ? preventNewAsteroid - 1 : 0; } } } }
private void createCircles(SolarSystem solarSystem) { int preventNewAsteroid = 0; for (int i = 1; i < maxCircles; i++) { var Type = typeDetector.getPlanetType(i); if (Type == 0) { continue; } if (solarSystem.StartSystem) { if (i > 11) { continue; } switch (Type) { case 9: case 10: case 11: case 12: createAsteroidCircle(solarSystem, i, (asteroidCircleTypes)(Type - 9)); AsteroidCirclesCount++; solarSystem.AsteroidCirclesCount++; break; default: createPlanetCircle(solarSystem, i, Type); break; } } else { if (Type > 8 && Type < 13) { //do not place an asteroid circle right beneath another one if (i == preventNewAsteroid + 1) { continue; } preventNewAsteroid = i; AsteroidCirclesCount++; solarSystem.AsteroidCirclesCount++; asteroidCircleTypes asteroidCircleType = (asteroidCircleTypes)randomGenerator.Next(0, 4); createAsteroidCircle(solarSystem, i, asteroidCircleType); if (showText && TextBox != null) { TextBox.Text += " Circle " + i + " Asteroid " + asteroidCircleType.ToString() + Environment.NewLine; } } else { if (showText && TextBox != null) { TextBox.Text += " Circle " + i + " Planet" + Environment.NewLine; } createPlanetCircle(solarSystem, i, Type); preventNewAsteroid = preventNewAsteroid > 0 ? preventNewAsteroid - 1 : 0; } } } }