Professional Documents
Culture Documents
Random;
import java.util.Scanner;
// Declare variables
static int width;
static int height;
static int[][] room;
static int playerX;
static int playerY;
static int bugX;
static int bugY;
static int goldX;
static int goldY;
static int holeX;
static int holeY;
static boolean hasGold;
// Game loop
while(true) {
steps++;
}
bugX = randomPosition();
bugY = randomPosition();
goldX = randomPosition();
goldY = randomPosition();
holeX = randomPosition();
holeY = randomPosition();
hasGold = false;
steps = 0;
inputs = 0;
}
if(spaces < 1) {
System.out.println("Steps must be 1 or greater");
return;
}
bugX += dx;
bugY += dy;
// Initialize 2D array
room = new int[height][width];
// Add walls
for(int i = 0; i < width; i++){
room[0][i] = 1;
room[height-1][i] = 1;
}
System.out.println("|");
}
System.out.println();
System.out.println("GAME STATS:");
System.out.println("Inputs: " + inputs);
System.out.println("Steps Taken: " + steps);
}