Create a program to perform the simulation

Assignment Help Computer Engineering
Reference no: EM1335275

Random Walk Simulation

A two-dimensional array (N X M) should be used to represent the number of times the bug reached each tile on the floor. All cells of this array should be initialized to zero. The position of the bug on the floor is represented by the coordinates (i-bug, j-bug). The eight possible moves the bug can make at each time interval are represented by the tiles located at [i-bug + i-move(k), j-bug + j-move(k)] where 1<k<8 and :

i-move(1) = -1 j-move(1) = 1
i-move(2) = 0 j-move(2) = 1
i-move(3) = 1 j-move(3) = 1
i-move(4) = 1 j-move(4) = 0
i-move(5) = 1 j-move(5) = -1
i-move(6) = 0 j-move(6) = -1
i-move(7) = -1 j-move(7) = -1
i-move(8) = -1 j-move(8) = 0

A random walk to one of the eight given squares is simulated by generating a random value for k lying between 1 and 8. The bug can not move up the wall so those coordinates which lead beyond a wall must be ignored and a new random combination formed. Each time a square is touched, the count for that square is incremented. Thus, a non-zero entry in the array shows the number of times the bug has landed on the corresponding square. When every square has been touched at least once, the simulation is complete.

Design a program to perform the simulation using a 40 by 20 tiled floor (N = 40, and M = 20). For each run, output:

a. The total number of legal moves which the bug makes
b. The final values in the N by M array (this will show the "density" of the walk, that is, the number of times each tile on the floor was touched during the experiment)

You should include an iteration limit, that is, a maximum number of squares that the bug may enter during the experiment. This assures that your program will not get "hung" in an infinite loop. A maximum of 50,000 iteration is appropriate for this simulation.

Reference no: EM1335275

Questions Cloud

Write down a program for the following decision table : The National Earthquake Information Center has asked you to write down a program for the following decision table to characterize an earthquake based on its Richter scale number.
Explain which of these methods of encouraging growth : Explain which of these methods of encouraging growth would you suggest to a newly industrialized economy.
Why do you think profit-sharing and lump-sum provisions : Why do you think profit-sharing and lump-sum provisions have increased in usage in recent years, while COLAs and wage reopeners have decreased in use?
Randomly sampling vs using a convenience sample : Find the advantages and disadvantages of randomly sampling vs using a convenience sample?
Create a program to perform the simulation : Each time a square is touched, the count for that square is incremented. Thus, a non-zero entry in the array shows the number of times bug has landed on the corresponding square. When every square has been touched at least once, the simulation is ..
Explain marketing- value chain and research : Explain Marketing- value chain and research and profitable customer and Why is marketing research so important before launching a new product
Each organization manager''s performance was evaluated yearly : Each organization manager's performance was evaluated yearly in relation to the specified multiple goals.
Examine future trends and compensation models : Examine future trends and compensation models or plans and discuss how these will affect your chosen industry and Recommend a strategy for ensuring that the reward system continues to align with organizational mission as  he mission evolves.
Higher group productivity : High cohesiveness in a group leads to higher group Productivity." Do you agree or disagree? Explain your answer.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Illustrate the constraint graph

Illustrate the constraint graph

  Make function that outputs the elements stored in the tree

Write down a program containing a function that outputs the elements stored in the tree (integers) to the screen. The integers have to be output level by level in the order they appear in the tree.

  Implementing the code

Write down a program which uses a structure named CorpData in order to store the following information about a company division: Involve a constructor that enables the division name and four quarterly sales amounts to be specified at the time a Cor..

  Why organization that meets the company''s specifications

A software application has been delivered to your organization that meets the company's specifications. Using associated examples, describe problems which may arise when it is installed and used in your organization.

  What are information systems and decision support systems

explain the different components of a decision support system and explain each one.Give some examples where the decision support system helps with making internal decisions.

  Write down a driver program to test your library

create a library containing functions to compute the surface area and volume of a sphere. For a sphere of radius r, these values can be calculated using.

  Describes a function named insidecircle

Describes a function named insideCircle

  What is the throughput

Measurements of the slotted ALOHA channel with an infinite number of users show that 10 percent of the slots are idle.

  What is green computing and green communication technology

What is Green Computing and Green Communication technology.

  Show the command line and accept one interger as input

Call a function the outputs seven sequential intergers, with input interger as the middle item on the command line below the input prompt.

  Studying the relational database

On the basis of this relational database; provide an expression in the relational algebra in order to express each of following queries: Determine the names of all students who have GPA greater than 3.

  Write down an object oriented program in java

take a rectangular matrix of cells, each of which can contain an organism. If the matrix is viewed as extending indefinitely in both directions, then each cell has eight neighbors, the eight cells surrounding it.

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