Draw a line that traces the walk as it progresses

Assignment Help Basic Computer Science
Reference no: EM131305082

1. Suppose you are doing a random walk (see previous problem) on the blocks of a city street. At each "step" you choose to walk one block (at random) either forward, backward, left or right. In n steps, how far do you expect to be from your starting point? Write a program to help answer this question.

2. Write a graphical program to trace a random walk (see previous two problems) in two dimensions. In this simulation you should allow the step to be taken in any direction. You can generate a random direction as an angle off of the x axis.

1760_ba1a7c9a-d9d7-4984-b8c7-0ef7c8e6a765.png

The new x and y positions are then given by these formulas:
x = x + cos(angle)
y = y + sin(angle)

The program should take the number of steps as an input. Start your walker at the center of a 100x100 grid and draw a line that traces the walk as it progresses.

Reference no: EM131305082

Questions Cloud

Time value of money adapted-discounting and compounding : Time Value of Money Adapted from Chapter 5 Mini-Case in Foundations of Finance Your task this week is to teach Grammy and the board the time value of money and its related concepts. She would like you to address several specific questions to demonstr..
Purchase significant amounts of stock in the companies : If commercial banks were allowed to purchase significant amounts of stock in the companies to which they make loans, would this increase or decrease the extent of moral hazard in the financial system? Briefly explain.
Who is the most influential industrial psychologist : Who is the most influential Industrial/Organizational Psychologist in history? and Why?
An article in the wall street journal in early 2010 : Over the past 35 years, has making loans to small business become a more important or a less important aspect of commercial banking? Briefly explain.
Draw a line that traces the walk as it progresses : The program should take the number of steps as an input. Start your walker at the center of a 100x100 grid and draw a line that traces the walk as it progresses.
Discuss about the cognitive development activities : Discuss about the Cognitive Development Activities.Piaget's theory of cognitive development, you will continue to build your Community Center Proposal by identifying an activity and a toy for one of the rooms in your center that promotes cognitive ..
Does banks capital appear on left side of balance sheet : Would a loan from the Treasury be counted as part of a bank's capital?- Does a bank's capital appear on the left side of the bank's balance sheet?
Analyze the legal rights and responsibilities of the tenant : Explore the legal rights and responsibilities of the tenant and the landlord. Decide whether or not the landlord and / or the tenant had a legal duty to mitigate damages.
Performs a simulation to estimate the probability of rolling : Suppose you take a random walk of n steps. On average, how many steps away from the starting point will you end up? Write a program to help you investigate this question.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  How do you respond to your boss''s request

The goal is to demonstrate the value of dashboards to help monitor and improve the operations in many of the firm's business units. You, along with over 20 middle managers, just completed a two-day in-house training course of the use of dashboards..

  Calculate the cyclomatic complexity number

a. Construct a control flow graph for one of the modules in the program. b. Calculate the cyclomatic complexity number for one of the modules in the program. c. Construct the design flow graph for the program. d. Calculate the design complexity of th..

  Describe the types of fixed cost contracts

Which type of contract is most appropriate to use if the scope is extremely well known, and which type is most appropriate if the scope is very uncertain? Explain your choices.

  Civilian and federal it infrastructure

With the current increase in security breaches affecting both the civilian and federal IT infrastructure, it is clear that there are no real IT solutions that can totally protect or provide a 100% defense against threats.

  Explain macintosh file structures and the boot process

Explain Macintosh file structures and the boot process. Be sure to give good detail. Explain UNIX and Linux disk structures and boot processes. Be sure to give good detail.

  Educational information is safeguarded

From the e-Activity, discuss how students' educational information is safeguarded. Decide if you believe that the safeguard methods are sufficient, too stringent, or too lenient and support your answer.

  Simulate the latch and show that it operates correctly

Then increase the inverter delay. How long does the delay have to be before a race condition causes the latch to malfunction?

  Letters of recommendation to find a job

As a student, you will need letters of recommendation to find a job, to apply for a scholarship or grant, or to enter graduate school. Naturally, you will consider asking one or several of your college instructors. You talk to a senior you know to..

  How would you modify the node-insertion algorithm

How would you modify the node-insertion algorithm described in Section 20.7.7?

  Determine the power produced by this engine

Determine the power produced by this engine and its thermal efficiency. Use constant specific heats at room temperature.

  Why do not we require the try catch block

why do not we require the try catch block

  Difference between a session cookie

Describe the difference between a session cookie and a persistent cookie?

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