mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 15:37:51 -08:00
Fixed random number range in Orbit.java.
This commit is contained in:
@@ -111,11 +111,10 @@ public class Orbit {
|
|||||||
String userResponse = "";
|
String userResponse = "";
|
||||||
|
|
||||||
// Begin outer while loop
|
// Begin outer while loop
|
||||||
while (true) {
|
while (true) {
|
||||||
|
shipAngle = (int) (361 * Math.random());
|
||||||
shipAngle = (int) Math.floor(360 * Math.random());
|
shipAltitude = (int) (201 * Math.random() + 200);
|
||||||
shipAltitude = (int) Math.floor(200 * Math.random() + 200);
|
shipRate = (int) (21 * Math.random() + 10);
|
||||||
shipRate = (int) Math.floor(20 * Math.random() + 10);
|
|
||||||
|
|
||||||
hour = 0;
|
hour = 0;
|
||||||
|
|
||||||
@@ -157,7 +156,7 @@ public class Orbit {
|
|||||||
|
|
||||||
// Win condition
|
// Win condition
|
||||||
if (bombDistance <= 50) {
|
if (bombDistance <= 50) {
|
||||||
System.out.println("YOU HAVE SUCCESFULLY COMPLETED YOUR MISSION.");
|
System.out.println("YOU HAVE SUCCESSFULLY COMPLETED YOUR MISSION.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user