refactored me() to action()

This commit is contained in:
Luke Rogers 2013-10-01 15:41:54 +13:00
parent 52f6260e1c
commit 72babfceb2
8 changed files with 22 additions and 22 deletions

View file

@ -3,7 +3,7 @@ import random
@hook.command(autohelp=False)
def coin(inp, me=None):
def coin(inp, action=None):
"""coin [amount] -- Flips [amount] of coins."""
if inp:
@ -15,10 +15,10 @@ def coin(inp, me=None):
amount = 1
if amount == 1:
me("flips a coin and gets {}.".format(random.choice(["heads", "tails"])))
action("flips a coin and gets {}.".format(random.choice(["heads", "tails"])))
elif amount == 0:
me("makes a coin flipping motion with its hands.")
action("makes a coin flipping motion with its hands.")
else:
heads = int(random.normalvariate(.5 * amount, (.75 * amount) ** .5))
tails = amount - heads
me("flips {} coins and gets {} heads and {} tails.".format(amount, heads, tails))
action("flips {} coins and gets {} heads and {} tails.".format(amount, heads, tails))