Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question

Program Use a matrix represents an island surrounded by water. Two bridges lead out of island. A mouse is placed on the black square. Write down a program to make the mouse take a walk across the island. The mouse is authorized to travel one square at a time, either horizontally or vertically. A random number from 1 through 4 should be used to decide that direction the mouse is to take. The mouse drowns while he hits the water; he escapes when he enters a bridge. You could generate a random number up to 100 times. If mouse does not find his way by the hundredth try, he will die of starvation. Restart mouse in a reinitialized array and go back and repeat the whole process. Calculate the number of times he escapes, drowns, and starves.

Input File

1. First input line - size of the array, include border of water and bridges

Next N input lines- rows of the two-dimensional array, where positions containing negative numbers represent the water, the position in the edge containing a 0 represent bridges, the position contain a 1 represents starting position of the mouse, and all other positions contain 0s.

Output

1. A line stating whether mouse escaped, drowned, or starved

2. A line show mouse's starting position and position of the two bridges

3. A map showing frequency of the mouse's visits to each position

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9133314

Have any Question?


Related Questions in Computer Engineering

Write a c program please follow instructions exactly this

Write a C++ program. PLEASE FOLLOW INSTRUCTIONS EXACTLY. This program takes its inputs from a file that contains numbers. The program reads them in as type double. The program outputs to the screen the  standard deviatio ...

Suppose that we want to convert the small computer into a

Suppose that we want to convert the small computer into a 16- bit RISC type of processor (address and data buses are both 16-bits wide and each instruction is supposed to occupy 16 bits in the instruction memory). If the ...

Question research and provide a write up on available

Question : Research and provide a write up on available routers and switches. The report should include information for at least two router and two switching devices. Included in the write-up should be a description of t ...

Suppose that we have the following cities mudville horns

Suppose that we have the following cities: Mudville, Horns, Farm Town, Almira, Billows, Carmenovsk, Dantub. They are in a rural county and have no paved roads. Your county government decides to build a paved network of r ...

Can someone please show me how to do this step by step

Can someone please show me how to do this step by step please. I dont understand any of it 1.) Add a new virtual disk a) Edit VMware player settings to add a new virtual hard disk. b) Start or reboot the virtual machine ...

Question list and describe two forms of organizational

Question: List and describe two forms of organizational change. How does organizational change create business innovation? Give an example. Reply substantively to two other learners with thought provoking statements and ...

What are the 5 classic components of a computer discussed

What are the 5 classic components of a computer discussed in class?

A set of coins makes change fornbspnnbspif the sum of the

A set of coins makes change for n if the sum of the values of the coins is n. For example, if you have 1-cent, 2-cent and 4-cent coins, the following sets make change for 7: 7 1-cent coins 5 1-cent, 1 2-cent coins 3 1-ce ...

Question sinksort is a f times n which helps sort

Question : Sinksort () is a f times n which helps sort sequences, in order to do so it makes switches (adjacent doubleheadarrow). Write a function which sorts a given sequence from smallest to largest.

Software engineeringanswer each of the following questions

Software Engineering Answer each of the following questions posed for control and data when applied a "stepwise refinement approach" to develop three different levels of procedural abstraction in a simple invoicing syste ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As