subject

Create a path for a mouse to travel in a maze. use a 2 dimensional array and start the mouse in location array [0][0]. the mouse must find its way to the opposite corner. repeatedly get a random number representing one of 8 possible moves. a legal move is one that moves forward, and does not run into the “edge” of the maze and does not land on a previous move. if the move is illegal the poor mouse must start over with location [0][0]. going forward is defined as the sum of the array indexes either increasing or staying the same. with each safe mouse move introduce a cat that may eat the mouse. the cat is a block of 4 maze location forming a square. with each safe move made by the create a cat. the random number generator generates a location that serves as the upper left corner location of the cat. the random number id dependent on the size and shape of the maze when the maze is first created. if the cat “catches” the mouse the mouse must begin again. make those operations methods that can be called in order to accomplish the cat aspect of the problem (make the cat as number -1 then turn -1 into letter c). use four or more methods to implement the cat part of the project. allow the mouse to repeatedly run the maze and choose the size of the two dimensional maze. the output consist of three numbers. first number is the number of times the mouse must start over before he finds a path from beginning to the end, the second is the number of times he falls off the maze and the third is the number of times the cat catches the mouse. then print the array to the screen showing the path that was successful.



this how output should look like

this program finds a path for a mouse from one corner to another

in a two dimensional maze.

enter the size of the maze.

how many rows would you like?

10

how many columns would you like?

12

it took 1,483,505 attempts to find a path.

the cat got the mouse 41,672 times.

the mouse fell off the maze 437,806 times.

1 0 0 0 0 0 0 0 0 0 0 0

0 2 3 0 0 0 0 0 0 0 0 0

0 0 0 4 5 0 0 0 0 0 0 0

0 0 0 0 0 6 0 0 0 0 0 0

0 0 0 0 0 7 0 0 0 0 0 0

0 0 0 0 0 8 0 0 0 0 0 0

0 0 c c 0 0 9 0 0 0 0 0

0 0 c c 0 0 0 10 12 13 14 0

0 0 0 0 0 0 0 11 0 0 15 0

0 0 0 0 0 0 0 0 0 0 0 16

enter the size of the maze.

how many rows would you like?

10

how many columns would you like?

10

it took 808,720 attempts to find a path.

the cat got the mouse 27,214 times.

the mouse fell off the maze 238,277 times.

1 2 0 0 0 0 0 0 0 0

0 3 0 0 c c 0 0 0 0

0 0 4 5 c c 0 0 0 0

0 0 6 0 0 0 0 0 0 0

0 0 0 7 0 0 0 0 0 0

0 0 0 8 9 0 0 0 0 0

0 0 0 0 0 10 0 0 0 0

0 0 0 0 0 11 0 0 0 0

0 0 0 0 0 0 12 0 14 0

0 0 0 0 0 0 0 13 0 15

enter the size of the maze.

how many rows would you like?

12

how many columns would you like?

12

it took 7,091,416 attempts to find a path.

the cat got the mouse 166,765 times

the mouse fell off the maze 2,096,108 times.

1 2 0 0 0 0 0 0 0 0 0 0

0 0 3 0 0 0 0 0 0 0 0 0

0 0 4 0 0 0 0 0 0 0 0 0

0 0 0 5 6 0 0 0 0 0 0 0

0 0 0 0 7 0 0 0 0 0 0 0

0 0 0 0 0 8 0 0 0 0 0 0

0 0 0 0 0 0 9 0 0 0 0 0

0 0 0 0 0 0 0 10 0 0 0 0

0 0 0 0 0 0 0 11 0 0 0 0

0 0 0 0 0 0 0 0 12 0 0 c

0 0 0 0 0 0 0 0 0 13 14 c

0 0 0 0 0 0 0 0 0 0 0 15

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 22.06.2019 17:30
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
How to launch an app: steps to be successful? launching an app is a great idea, but it’s not that easy as we supposed to think. the majority of mobile applications don’t generate revenue because companies aren’t ready to be competitive. referring to our experience in successfully building and launching apps we hope to you omit these difficulties. we are going to talk about ideas, marketing, testing your product, its development, distribution and support. you will learn 8 product launch stages to succeed.
Answers: 1
You know the right answer?
Create a path for a mouse to travel in a maze. use a 2 dimensional array and start the mouse in loca...
Questions
question
Mathematics, 28.01.2020 07:31
question
Mathematics, 28.01.2020 07:31
Questions on the website: 13722367