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

  Engineering ethics and ethical issue

what is the engineering ethics course where to write about any engineering ethical case and discuss the ethical issue?

  Engineering ethics and concept and cases

what is the engineering ethics case related to civil engineering with reference and discuss all the engineering ethics issues which covered the "Engineering etics concepte and cases?

  Transportation and management

In the construction management, there is a lot of procurement route that are necessary and suitable for the construction industry.

  Supporting Investment Promotion: ERNST & YOUNG

Ernst & young is currently providing support to various sectors. In this regards it was felt that if this report is able to document good practices currently being adopted or planned in ceramic sector.

  Personalized Cancer Therapy-A step forward

Cancer is the uncontrolled growth of abnormal cells in the body resulting in tumours that can be benign or malignant (cancerous cells). A proper treatment is necessary to fight with this serious disease.

  Discuss the different environmental companies

Discuss the different agencies, institutes, centers, different environmental companies that are active in UAE.

  Develop a simple urban constructed wetland design

Develop a simple urban constructed wetland design.

  Evaluate company performance in relation to GRI standards

Evaluate company performance in relation to GRI standards and comment on Stigler's theory.

  Water system design

Determine the corresponding error in the computed discharge

  Hydraulic behaviour in open channel

Describe how test flumes and associated equipment are used to assess and confirm hydraulic behaviour in open channel

  Write a paper on steel sustainability

Write a paper on steel sustainability.

  Writing case study about bridge collapse

Writing case study about bridge collapse

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