commit a8c80dc89cecb7c132ccfcd4d0a6f18b3d172d9d
parent 2fe6da136e5c577d8197e2d0846017f5e4adc390
Author: Antoine Amarilli <ant.amarilli@free.fr>
Date: Sat, 21 May 2011 12:48:59 -0400
ignore bots
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/snipe.py b/snipe.py
@@ -17,6 +17,7 @@ abort_penalty = 2
mission_file = "missions"
name = "arbitre"
dump_file = "game.dmp"
+ignore = "bot"
help = [
"Chaque joueur a une liste secrète de mots qui lui rapportent des points.",
@@ -40,7 +41,7 @@ def parse(line):
return chan, speaker, message.rstrip(), to_us
def split(message):
- return re.split("[^\w']+", message, flags=re.UNICODE)
+ return re.split("\W+", message, flags=re.UNICODE)
def read_missions(name):
f = open(name)
@@ -160,6 +161,8 @@ try:
if (not line):
raise ValueError
chan, speaker, message, to_us = parse(line)
+ if speaker.find(ignore) != -1:
+ continue
if speaker not in list(game.keys()):
game[speaker] = Player(speaker)
if to_us: