Write a program use a matrix represent

Assignment Help Computer Engineering
Reference no: EM132543

Question

Write a Program Use a matrix represents an island surrounded by water. Two bridges lead out of the island. A mouse is positioned on the black square. Write down a program to make the mouse take a walk across the island. The mouse is allowed to travel one square at a time, either horizontally or vertically. A chance number from 1 through 4 have to be used to decide that direction the mouse is to take. The mouse drowns when he hits the water; he breaks out when he enters a bridge. You might 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 the mouse in a reinitialized array and go back and repeat the whole process. Count up the number of times he escapes, drowns, and starves.

Input File-

1. First input line - size of array, as well as border of water and bridges

2.Next N input lines-the rows of the two-dimensional array, where the positions containing negative numbers represent the water, the positions in the edge containing a 0 represent the bridges, the position containing a 1 represents the 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 the mouse's starting position and the position of two bridges

3. A map show the frequency of the mouse's visits to each location

 

Reference no: EM132543

Questions Cloud

Explain the client-server architecture : What are the three different categories of command, support your answer by giving three examples. Give three good reasons, with valid explanation, to justify why partitioning hard disk provides a variety of advantages. Explain the client/server..
What is the main advantage of multiprogramming : What is the main advantage of multiprogramming How does the distinction between the monitor mode and user mode function as a rudimentary form of protection (security) system What is the difference between a trap and an interrupt? What is the u..
Explain deadlock-avoidance system : What is the difference between a safe state and an unsafe state in a deadlock-avoidance system?
Explain the concepts of consumable and reusable resources : Explain the concepts of consumable and reusable resources
Write a program use a matrix represent : Write a Program Use a matrix represent.
How to set up or recover cybersecurity : How to set up or recover cybersecurity.
Write a function that creates a cell and structure array : Write a function that creates a cell and structure array.
Prepare the entry doeby will record to reflect acquisition : Prepare the entry Doeby will record to reflect this additional acquisition.
Illustrate decryption equation : Illustrate decryption equation.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write a function called is_anagram

Write a function called is_anagram.

  Illustrate precedence graph

Illustrate precedence graph

  What is a backup strategy or active directory?

What is a backup strategy or Active Directory? The small business that you created new domain controllers for now wants you to develop a backup and recovery plan for Active Directory.

  Type of data standard

What type of data standard are we dealing with in each scenario (metadata, spatial or attribute)? You work for Town of Ancaster prior to an amalgamation of New City of Hamilton. Your main responsibility was to retain Town's single line road network f..

  How to store ten floating-point values into vector

How to store ten floating-point values into vector. Write down a program that declares a vector of ten floating-point values

  Program to find smaller between num1 and num2 to output

Program to find smaller between num1 and num2 to output

  How to create program that performs arithmetic function

How to create program that performs arithmetic function Prompt a user for values for the variables. Pass both variables to methods named sum() and difference().

  Why is an object (oop) a module

Why is an object (OOP) a module

  Explain fast process of distributing the cards to accountant

Explain fast process of distributing the cards to accountant.

  Write down an account class

Write down an Account Class.

  Utilize server manager to install dns role

Utilize Server Manager to install DNS role

  Determine technology which has changed cafe,coffee shop

Determine technology which has changed cafe,coffee shop? Think things such as marketing, food preparation, inventory ordering or re-ordering, customer tracking, and more.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd