Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will make a simple game where the user creates a wild jungle and navigates a

ID: 3718922 • Letter: Y

Question

You will make a simple game where the user creates a wild jungle and navigates around the world exploring various animals and adding them to the observed animals list!

Here are the instructions:

At the beginning of the program, introduce the program and explain to the user how the game works:

Welcome to the jungle world creator!

In this game, you will be inserting animals in certain places in the world that you create! You will also be allowed to remove animals from certain locations before you start exploring!

Once you start exploring, you will navigate around the world to observe the animals that you have inserted.

The game will keep track of all the animals you have observed!

You will be using 3 parallel two-dimensional arrays for this program as well as a 1D array:

2D String array to create the visible world the user navigates in.

2D String array that keeps track of animals in the world.

2D boolean array that keeps track of whether the spot was explored or not.

1D String array to keep track of observed animals. It’s length should be the length of world*width of the world.

Notes:

Make sure to initialize all the values in the boolean array to false, except the starting position (0,0) is set to true.

Make sure to initialize all the values in the animalWorld and observedAnimals array to be “” because otherwise it will be initialized to null and you need to deal with it using if statements.

Make the 2D boolean array a global variableand initialize it only in the main method.

You must have the following methods created and used within your program:

1.makeWorld(String[][] world, int posX, int posY)

2.printMainMenu()

1. Insert an animal into the world

2. Remove an animal from the world

3. Explore the world

3.printMoveMenu()

            W. Move Forward

A. Move Left

S. Move Backward

D. Move Right

I. Display observed animals

N. Sort the observed animals list by alphabetical order

E. Exit

4.insertAnimalToWorld(String[][] animalLocations)

                        -  The  x and y coordinates are in the world’s boundaries

                        - The area [x,y] is not occupied by another animal

            If the conditions are not met prompt the user to enter the coordinates as well as the animal name again until the conditions above are met.

5.removeAnimalFromWorld(String[][] animalLocations)

                        -  The  x and y coordinates are in the world’s boundaries

                        - The area [x,y] is not empty (contains an animal)

            If the conditions are not met prompt the user to enter the coordinates until the conditions above are met.

Hint:To remove the animal you can just set the String at [x,y] to “” .

6.isEmptyBlock(String[][] animalWorld, int x, int y)  ? Returns false if the array has an animal at [x,y] and true if [x,y] is empty.

7.updateObservedAnimals(String[] observedAnimals, String animal)

8.printWorld(String[][] world)

9.move(String[][] world, int x, int y, String[] observedAnimals, String[][] animalLocations)

10.explore(String[][] world, String[][] animalLocations, String[] observedAnimals)

11.printObservedAnimals(String[] observedAnimals)

12.isExplored(int x, int y)

13.sortAnimalList(String[] observedAnimals) Bubble Sort or Selection Sort algorithms. You are NOTallowed to use Arrays.sort() for this method.

***JAVA PROGRAMMING IN ECLIPSE***

Explanation / Answer

import java.io.*;
class Wj
{
public static String visibleworld[][];
public static String animalWorld[][];
public static String observedAnimals[];
public static boolean visited[][];

public static void makeWorld(String [][] world, int x,int y)
{
world[x][y]="x";//intial position of explorer
for(int i=0;i<world.length;i++)
{
for(int j=0;j<world[i].length;j++)
{
System.out.print(world[i][j]+" ");
}
System.out.println();
}
}


public static void printMainMenu()
{
System.out.println(" 1 enter to insert 2 to remove and 3 to explore animal");
int choice=Integer.parseInt(System.console().readLine());
switch(choice)
{
case 1:
int x,y;
do{  
System.out.println("enter animal name x and y coordinate to insert animal");
x=Integer.parseInt(System.console().readLine());
y=Integer.parseInt(System.console().readLine());
}

while(animalWorld[x][y]!="");
System.out.println("enter animal name");
String name=System.console().readLine();
insertAnimalToWorld(name,x,y);
break;
case 2:
do{  
System.out.println("enter animal name x and y coordinate to remove animal");
x=Integer.parseInt(System.console().readLine());
y=Integer.parseInt(System.console().readLine());
}

while(animalWorld[x][y]=="");
removeAnimalFromWorld(x,y);


break;
case 3:printMoveMenu();

}
}

public static void insertAnimalToWorld(String name, int x,int y)
{
animalWorld[x][y]=name;
}

public static void removeAnimalFromWorld(int x,int y)
{
animalWorld[x][y]="";
}


static boolean isExplored(int x,int y)
{
if(visited[x][y]==true)
return true;
else return false;
}
public static void main(String [] s)
{
visibleworld=new String[10][10];
for(int i=0;i<visibleworld.length;i++)
for(int j=0;j<visibleworld[i].length;j++)
visibleworld[i][j]="*";
makeWorld(visibleworld,0,0);
animalWorld=new String[10][10];
for(int i=0;i<animalWorld.length;i++)
for(int j=0;j<animalWorld[i].length;j++)
animalWorld[i][j]="";
observedAnimals=new String[100];
for(int i=0;i<observedAnimals.length;i++)
observedAnimals[i]="";
visited =new boolean[10][10];
visited[0][0]=true;
for(int i=1;i<10;i++)
for(int j=1;j<10;j++)
visited[i][j]=false;
printMainMenu();

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote