Create 3 user defined functions to use in the script


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.

Request for Solution File

Ask an Expert for Answer!!
Civil Engineering: Create 3 user defined functions to use in the script
Reference No:- TGS0655300

Expected delivery within 24 Hours