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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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