## simulate a flipping coin. ## make the coin using makecoin and update its position using ## coinupdate. Stop the simulation when the coin is no longer ## moving and report on which face is up. from CoinFlipModule import * scene.autoscale = 0 floor=box(color=color.white, pos=(0,-0.3,0), height=0.4,width=6,length=12) dt = 0.0005 ## make a coin at position 0, with angle of 1.4 radians coin1 = makecoin(0, 1.4) ## while the reference coin is still moving while coinmoving(coin1): # update the coin (0.08 is the momentum # lost in each bounce - if 0, would bounce forever.) coinupdate(coin1, 0.08, dt) coinreport(coin1)