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

  How to create the clients by service rep report

How to create the clients by service rep report create mailing label for client table

  How to create another c-sharp project

make  a C-Sharp project that stores personal information for a little electronic "black book". The fields in the file should include name, phone number, pager number, cell phone number, voice mail number, and e-mail address. Use text boxes to ente..

  Guassian function and digital transmission technique

Prove the following properties of Gaussian function:Explain four benefit and one de-merits of utilizing the digital (rather than the analog) techniques for transmission of the voice-telephone signals.

  Define four phases of an information system''s life cycle

What are the 4 phases of an information system's life cycle? The business process of building and managing information system has four phases. These phases apply to all information systems although different systems may be acquired using different..

  Service is used to automatically assign ip addresses

explain an IP address. Describe Class A, B, and C networks. Are a MAC address and an IP address the same thing? What network service is used to automatically assign IP addresses? Describe the four steps of the IP address lease process.

  Complete the design wlan based on ieee 802.11

Explain why 802.11b, is the first widely popular standard and still by far most used by the IT industry today.

  Design should show each object''s encapsulated methods

make a class diagram (in Visual Studio 2008 C#) based on the following scenario: When constructing classes that will represent objects in a system, it is important to ensure the integrity of those objects and be able to define the types of relatio..

  How could companies offering "free" products

The seminar uses Linux as an example of a company that understands competitive positioning. How can companies offering "free" products (e.g., Linux, Netscape) make money from these products? How can other companies compete with these fast-rising s..

  Prepare an analysis discussing the factors

While there is backward compatibility between the various versions of the software, the older versions do not have all of the "bells and whistles" of the newer versions.

  Various counter controlled repetitive control structures

Write down the example that demonstrates different techniques of passing arguments: by value, by reference, and as pointers. Discuss the three methods.

  Make java class that creates an array of integers

Write down a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.

  Define difference between a shallow copy and a deep copy

Overload the operator += for the class newString to perform the following string concatenation; suppose that s1 is "Hello" and s2 it "there". Then the statement s1 += s2; should assign "Hello there" to s1, where s1 and s2 are newString objects.

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