Jabber/XMPP conference bot & framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
brathuhn/modules/active/boggle.py

51 lines
1.5 KiB

import brathuhn, random, time
DICE = [['A','A','A','F','R', 'S']]
DICE.append(['A','A','E','E','E','E'])
DICE.append(['A','A','F','I','R','S'])
DICE.append(['A','D','E','N','N','N'])
DICE.append(['A','E','E','E','E','M'])
DICE.append(['A','E','E','G','M','U'])
DICE.append(['A','E','G','M','N','N'])
DICE.append(['A','F','I','R','S','Y'])
DICE.append(['B','J','K','Qu','X','Z'])
DICE.append(['C','C','E','N','S','T'])
DICE.append(['C','E','I','I','L','T'])
DICE.append(['C','E','I','P','S','T'])
DICE.append(['C','E','I','L','P','T'])
DICE.append(['D','D','H','N','O','T'])
DICE.append(['D','H','H','L','O','R'])
DICE.append(['D','H','L','N','O','R'])
DICE.append(['D','H','L','N','O','R'])
DICE.append(['E','I','I','I','T','T'])
DICE.append(['E','M','O','T','T','T'])
DICE.append(['E','N','S','S','S','U'])
DICE.append(['F','I','P','R','S','Y'])
DICE.append(['G','O','R','R','V','W'])
DICE.append(['I','P','R','R','R','Y'])
DICE.append(['N','O','O','T','U','W'])
DICE.append(['O','O','O','T','T','U'])
def timesup(a):
brathuhn.sendMsg(brathuhn.ROOM,"Time's up!",'groupchat')
def boggle(msg,args):
if len(args)==1:
mymsg = ""
random.shuffle(DICE)
i = 0
for d in DICE:
if i % 5 == 0:
mymsg += "\n"
i+=1
mymsg += "%3s" % ( d[random.randint(0,5)] )
brathuhn.sendMonoMsg(brathuhn.ROOM,mymsg,'groupchat')
brathuhn.sendMsg(brathuhn.ROOM,"you have 3 minutes",'groupchat')
brathuhn.callAt(timesup, time.time()+60*3, [1])
else:
brathuhn.sendMsg(brathuhn.ROOM,"Usage: !boggle",'groupchat')
brathuhn.addCommand("boggle","Usage: !boggle",boggle)