Program on matrix

Assignment Help Computer Engineering
Reference no: EM132897

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

Reference no: EM132897

Questions Cloud

Program of five to ten lines in assembly language : Program of five to ten lines in assembly language
Program for dissimilar values for real numbers : Program for dissimilar values for real numbers
Identify and discuss four characteristics of events : Identify and discuss four characteristics of events Using as example an event of your choice, elaborate on the benefits the event brings, in social and economic terms
Describes a function named insidecircle : Describes a function named insideCircle
Program on matrix : Program on matrix
Discuss aspects that could be considered for classification : What are the facilities for a first class hotel and how are they relevant to its category of clientele? Discuss the other aspects that could be considered for classification
Discuss the importance of nutrition : Discuss the importance of the following for the food service industry: (i) Hygiene (ii) Nutrition
Describe the characteristics of visual studio 2005 : Describe the characteristics of Visual Studio 2005 Visual Studio.Net is a suite of products that includes 4 main languages. Name these languages and outline their use in industries
Discuss the main hrm challenges facing public leaders : Discuss the main HRM challenges facing public leaders Describe the common reform trends in HRM in the past two decades

Reviews

Write a Review

Computer Engineering Questions & Answers

  Examine the importance and purpose of of n-tier systems

Examine the importance and purpose of of n-tier systems

  What occurs in an infinite loop

What occurs in an infinite loop? Create your own Repeat-until repetition arrangement.

  Examine the behavior of airfoil

Write HW assignment written in Matlab airfoils have different C mc/4

  Write a program that mimics a flop-turn-river of poker game

Write down a program that mimics a flop-turn-river of a poker game. I must have three buttons titled Deal, Shuffle and Start Over.

  Classify enterprise wide system in hospitals today

Classify enterprise wide system in hospitals today. Classify all external system that interface with the facility or organization.

  Queries in relational algebra

Queries in relational algebra.

  How many address lines are needed to access memory

How many address lines are needed to access memory.

  How to write a program to find a traffic violation number

How to write a program to find a traffic violation number?

  Recognize how to locate fsmo roles

Recognize how to locate FSMO roles?

  Spreadsheet model of the heat transfer situation

Spreadsheet model of the heat transfer situation

  Explore paper on vmware security

Explore paper on VMware Security

  Illustrate decryption equation

Illustrate decryption equation.

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