ENGINEERING Write a script file to simulate 100 plays of a game in which you ip two
coins. You win the game if you get two heads, lose if you get two tails, and
ip again if you get one head and one tail. Create three user -de ned functions
to use in the script. Function ip simulates the ip of one coin, with
the state s of the random number generator as the input argument, and the
new state s and the result of the ip (0 for a tail and 1 for a head) as the
outputs. Function ips simulates the ipping of two coins and calls ip.
The input of ips 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 win, 0 for lose) and the new state s. The
script should reset the random number generator to its initial state, compute
the state s, and pass this state to the user-de ned functions.