Write a script file to simulate 100 plays of a game in which

Assignment Help Civil Engineering
Reference no: EM13550328

Write a script file to simulate 100 plays of a game in which you flip two coins. You win the game if you get to heads, loose if you get two tails, and flip again if you get one head and one tail. Create 3 user defined functions to use in the script. function "flip" simulates the flip of one coin with the state "s" of the random number generator as the input argument, and the nes state "s" and the result of the flip (0 for a tail and 1 for a head) as the outputs. Function "flips" simulates the flipping of two coins and calls "flip". The input of "flips" is the state "s", and the outputs are the new state "s" and the result (0 for two tails, 1 for a head and a tail, and 2 for two heads). Function "match" simulates a turn at the game. Its input is the state "s", and its outputs are the result (1 for a win, 0 for a lose) and the new state "s". The scrip should reset the random number generator to its initial state, compute the state "s", and pass this state to the user-defined functions.

Reference no: EM13550328

Questions Cloud

Determine the hydraulic conductivity of the soil : In a constant-head permeability test a sample of soil12 cm long and 6 cm in diameter discharged at 1.5*10^-3 of water in 10 minutes. The head difference in two piezometers A and B located at 1 cm and 11 cm
Prepare the adjusting entries for the month of march : One-half of the unearned revenue was earned in March - Prepare the adjusting entries for the month of March
Calculate the hydraulic conductivity if the porosity of sand : A constant-head test was conducted on a sample of soil 15cm long and 60 cm^2 in cross-sectional area. The quantiities of water collected was 50 cm^3 in 20 seconds undera a head difference of 24 cm.
Estimate the kinetic energy of the ejected electron : Light of wavelength 56 ionizes a hydrogen atom that was originally in its ground state. What is the kinetic energy of the ejected electron
Write a script file to simulate 100 plays of a game in which : Write a script file to simulate 100 plays of a game in which you flip two coins. You win the game if you get to heads, loose if you get two tails, and flip again if you get one head and one tail.
What is the magnitude of the runner centripetal acceleration : A runner rounds a circular curve of radius 24.0 m at a constant speed of 5.25 m/s. What is the magnitude of the runner's centripetal acceleration
What is the lowest grade possible for the constant-grade : A tangent section of highway has a -1.0% grade and ends at station 4+75 and elevation 82 ft. It must be connected to another section of highway that has a -1% grade and that begins at station 44+12 and elevation 131.2 ft.
Operating activities section of blues travelers statement : Prepare the operating activities section of Blues Travelers statement of cash flows for the year ended December 31, 2008, using the indirect method.
Calculate the volume of thickened sludge : The compound bar carries the axial forces P and 2P. Find the maximum allowable value of P if the working stresses are 40 ksi for steel and 20 ksi for aluminum, and the total elongation of the bar is not to exceed 0.2 in.

Reviews

Write a Review

Civil Engineering Questions & Answers

  Describe did the water depth increase or decrease

For each of the following transitions, draw E2,y2 on the specific energy chart and fully describe the reasoning. a. In a rectangular channel, there is a sudden drop in the channel bottom. Did the water depth increase or decrease

  Draw a plan of a typical strip mine

Draw a plan of a typical strip mine showing all operational features and equipment and why is the working slope of an open pit usually much flatter than the final slope?

  The first one is a plug flow reactor with a residence time

Plot the concentration of tracer at the outlet of the each of the two reactors during the first 24 hours of the tracer study. (Hint: You may need to use mass balances to obtain equations that predict the concentration of tracer as a function of time)

  Determine what is the decrease in thickness of the 6-ft fill

A loose, uncompacted sand fill 6 ft in depth has a relative density of 40%. Laboratory tests indicated that the minimum void ratios of the sand are 0.46 and 0.90, respectively. The specific gravity of solids of the sand is 2.65.

  Establish and sketch the energy equation for the scenario

write solution in a organized and easy to follow matter. Will rate life saver for diagram or picture.Water leaves a treatment plant in a 500-mm diameter ductile iron pipeline at a pressure of 600 kPa

  Calculate the min velocity of flow in ft per sec of water

Calculate the minimum velocity of flow in ft/sec and m/sec of water at 160 degrees F in a 2 in. dia pipe for which the flow is turbulent

  Find e for tendon to be concordant

Find e1, e2, e3 for tendon to be concordant - find deflection at those location

  Determine rate of change of temperature observed by cyclist

A bicyclist leaves from her home at 9am and rides to a beach 40 miles away. Because of a breeze off the ocean, the temperature at the beach remains 60 degrees F throughout the day.

  Problem regarding helium balloons

To float a 160 pound man using helium balloons (assume 0.52 cubic feet per inflated balloon). How many balloons would it take? Assume density of air is 1.29 kg/cubic meter and the density of helium is 0.179 kg/cubic meter.

  Calculate the escalaed dollar irr for an escalated dollar

an investment of $80,000 is projected to generate escalated dollar net revenues (income minus costs) of $10,000 in year one, $30,000 in year 2 and $40,000 in year 3 with a $100,000 salvage value at the end of year

  Determine what is the outlet air temperature

A total of 13,610 kg/h of air at 1 atm abs pressure and 15.6C is to be heated by passing over a bank of tubes in which steam at 100C is condensing. The tubes are 12.7mm OD, 0.61 m long, and arranged in-line in a square pattern with Sp=Sn= 19.05mm.

  Current magnetic bearing of the same line

Given an azimuth of 251 degrees 11' 23" for line ED. If theangle at DEO is 197 degrees 26' 12" measured clockwise, what is theazimuth and bearing of line EO?

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