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

  Convert the bearings to azimuths from north

Convert the bearings to azimuths from north and compute theangle . smaller then 180 degree. between successive bearings.

  Magnitude of the acceleration of the train

The train passes point A with a speed of 30 m/s and begins to decrease its speed at a constant rate of at = - 0.25 m/s2. Determine the magnitude of the acceleration of the train when it reaches point B, where sAB = 412 m.

  What is the diameter d of the smallest -size particles

in a hydrometer test , the results are as follows:Gs =2.60 , temperature of water=24c ,and R=43at 60 min after the start of sedimentation . what is the diameter , D, of the smallest -size particles

  Describe what is the maximum acceptable internal pressure

of 2640 psi with a factor of safety of 2.0 with respect to yielding. the yield stress of the steel is 65,000 psi in tension and 32,000 psi in shear. the diameter of the tank is 7.0 in. the minimum required wall thickness is 0.289 in.

  Mixed liquor volatile suspended solids

For a mixed liquor volatile suspended solids (MLVSS) of 1800 mg/L, what is the total return solids flow rate?

  Explain how to estimate the et losses for the area in 1 year

It the mean annual runoff of a drainage basin of 10000 km^2 is 140 m^3/s, and the average annual precipitation is 105 cm, estimate the ET losses for the area in 1 year. What are your assumptions

  What maximum load can be applied tot the center of the beam

A simply supported steel 'I beam' is made of three 1"*8" plates with a mass of 898.4 lbmass each as shown in I beam form. Steel has a modulus of elasticity of 30*10^6 psi. The beam is allowed to deflect 1.05 inch.

  At the time what percentage of the principal has been paid

A company borrowes $25000 at an interest rate of a nominal 16% per year compounded quarterly. The company desires to repay the loan in 36 equal quartely payments, with the first payment starting three months from now.

  Define need before function

Which of the following is not a basic systems engineering concept?a. Define need before function

  Determine maximum value of z if flow is to remain laminar

The slope of the hill is such that for each mile (5280 ft) of horizontal distance, the change in elevation is Δz. Determine the maximum value of Δz if the flow is to remain laminar and the pressure all along the pipe is constant.

  Find the final temperature and find the process work

A constant pressure container is filled with 1 kg of stainless steel and 0.5 kg of PVC (polyvinyl chlo- ride) both at 20C and 0.25 kg of hot air at 500 K, 100 kPa. The container is now left alone with no external heat transfer.

  What are the velocities of both just before and after impact

What are the velocities of both just before impact and just after impact. There is a distance of 5m between the vehicles prior to the winch being turned on.

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