def flip_coin(game, thing):
  if random.random() > 0.5:
    game.output("The coin shows heads.");
  else:
    game.output("The coin shows tails.");

# Phrase functions take a single argument 'game'.   The game argument can be used to access all
# parts of the game, including the player and it can be used to produce output.
# The 'if' statement controls execution of two blocks of code, the true block and the false block.
# After 'if' is an 'expression' which determines which block will run.  In this case the
# expression is random.random() > 0.5 which executes the random() function from the 'random
# module which returns a number betwee 0 and 1 (e.g. 0.523452).  It then compares the result
# to 0.5 (halfway in between) and either outputs a message that the coin shows heads or that it
# shows tails.

# Now we forgot an important part.  This function will run if the coin is present, but we
# want to make sure that the player has picked up the coin first.  Let's add that requirement.
# Normally we would change the above definition, but because this is a tutorial, we will just
# repeat it here with the corrected version (python will just overwrite the old version).
dataset/ETHPy150Open gever/bwx-adventure/tutorial2.py/flip_coin/original