Question: Calamari Contest. This year's Calamari Contest ? 1 1 involves an infinite bridge made of blacked - out digital displays aligned end - to -

Calamari Contest. This year's Calamari Contest ?11 involves an infinite bridge made of
blacked-out digital displays aligned end-to-end like concrete squares in a sidewalk. A
player, in attempting to cross the bridge, advances square-by-square. When a square
in a row is stepped on, it either reveals a picture of fried calamari with probability p
(and the player who stepped on it is eliminated) or turns solid green, and is allowed to
advance to the next square. The player who goes the longest before being eliminated
wins.
(a) A player's lifetime is defined as the number of squares stepped on before calamari
is revealed. In expectation, what is a player's lifetime? Equivalently, what is E[i]
where i is the return-value of walk (p) in the following pseudocode?
from random import uniform
def is_calamari(p):in the range [0,1) uniformly at random.
return uniform(0,1) p
def walk(p):
i =0
while not is_calamari(p):
i+=1
return i
(b) Turns out we don't have the budget for an infinite bridge. What if the length of
the bridge is limited to n0 rows (In other words, what is E[i] where i is the
return-value of walk2(p,n) in the following pseudocode)?
def walk2(p, n):
i =0
for _ in range(n):
if is_calamari(p):
break
i+=1
return i
(c) Wait a minute! If you did that right, the game got easier yet the life expectancy
decreased. This is correct. Explain why.
Calamari Contest. This year's Calamari Contest ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!