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.:- M9718566

Have any Question?


Related Questions in Computer Engineering

An article in the wall street journal noted that an

An article in The Wall Street Journal noted that an" increase in the price of crude oil quickly reduces demand for oil". Do you agree with this statement? Briefly explain.

Explain the differences between working in the web based

Explain the differences between working in the web based version of Outlook in Office 365 to the desktop application version of Outlook.

What is the broadcast domain and ports for hubs and

What is the Broadcast Domain and Ports for hubs and bridges?

Describe the structure of an inverted index in information

Describe the structure of an inverted index in Information retrieval?

Consider a valleyed array a1 2 middot middot middot n with

Consider a valleyed array A[1, 2, · · · , n] with the property that the subarray A[1..i] has the property that A[j] > A[j + 1] for 1 ≤ j (a) What is a recursive algorithm that takes asymptotically sub-linear time to find ...

When talking about economics and the history of it for the

When talking about Economics and the history of it. For the past recessions the U.S. has had, do we look at it mostly on the loan side of the banks or what causes most recessions?

Explain how amazon and walmart companies use information

Explain how Amazon and Walmart companies use Information and Communication Technologies (ICT) in their competitive strategies. Highlight the differences in their use of ICT.

A firm faces the following inverse demand curvep

A firm faces the following inverse demand curve P= 54-0.5Q Where P is the price of output and Q is the number of outputs sold per hour. This firm is the only employer in town and faces an hourly supply of labor given by: ...

Write a program that takes as input an xy center value and

Write a program that takes as input an x,y center value and radii for two circles, draws them in a turtle (Python) window, and prints whether they intersect or not. You should show intersecting circles, and show non-inte ...

How do you calculate the annual interest rate of 12

How do you calculate the annual interest rate of 12% compounded monthly. I know how to do for annually but not monthly. You are offered the opportunity to put some money away for retirement. You will receive 10 annual pa ...

  • 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