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

  Factors affecting the group process and outcome

In class, we introduced different factors which may affect group process and outcome, like group size and the status effect.

  Create a c program that accepts a string of characters

Write a C program that accepts a string of characters from a terminal and displays the string one word per line. Make your array 80 characters and suppose the entered text will be less than 80 characters. A complete C program is included as well a..

  Generate a class name that starts with string variable

Generate a class Name that starts with string variable

  The similarities osi model and the tcp/ip architecture

List and describe each layer of the OSI model. What is the main purpose of the OSI model.

  Engineer using an automated monitoring system

auto mechanic with an automatic diagnostic system.a train engineer using an automated monitoring system.

  Write the program in c++ language

Write a program to read a student's number, his or her old grade point average, and old number of course credits (e.g., 31479, 3.25, 66) and to then print these with appropriate labels.

  Writing down the script

Write down a script known as whichdaemon.sh that checks if the httpd and init daemons are running over your system. If an httpd is running.

  Comapre the advantages and disadvantages of using javascript

comapre the advantages and disadvantages of using JavaScript on the client-side. Where JavaScript is blocked or disabled, does that amount to a potentially significant business loss.

  How to create a usetvshow.java file

design a class named TVShow.java. Data Fields can include a String containing the Name of the show, a String containing the day that the show is broadcast(i.e. â??Mondayâ?) and an integer for the channel where the show can be viewed.

  Sketch a basic network suggesting how many routers

plan a basic network suggesting how many routers and hubs etc for each floor. As well, find out what to use to connect i.e. Cat5 wire,etc.

  New network equipment based on the above description

A fast and reliable PLC communications network is important to ensure that production remains uninterrupted. If equipment failure occurs, time is spent on troubleshooting and repair.

  Project management process

Discuss what do you meant by the project management process in detail? Also state and describe the six project steps, its application to the technology projects.

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