]> gitweb.pimeys.fr Git - bots/hung.git/commitdiff
On utiliser les non_guess_chars aussi pour calculer les % de contribution.
authorVincent Le Gallic <legallic@crans.org>
Sat, 8 Jun 2013 17:11:47 +0000 (19:11 +0200)
committerVincent Le Gallic <legallic@crans.org>
Sat, 8 Jun 2013 17:11:47 +0000 (19:11 +0200)
hung.py

diff --git a/hung.py b/hung.py
index dbeff29e5c60d0736ed6209c62eeaedfd195907d..c022105f9db7894f4825e846fed7fe0fc31a2eab 100755 (executable)
--- a/hung.py
+++ b/hung.py
@@ -512,7 +512,7 @@ class Hung(ircbot.SingleServerIRCBot):
     def gagne(self, serv, canal, bonus=None, bonusvalue=2):
         serv.privmsg(canal,"Bravo !")
         realword = self.reveal_word(serv, canal)
-        nlettre=float(len(realword.replace("'","").replace("-","")))
+        nlettre=float(len([l for l in realword if not l in config.non_guess_chars]))
         contribs=["%s:%s%%%s"%(pseudo,str(int(100*contrib/nlettre)),("+bonus(%s)"%(bonusvalue))*(bonus==pseudo)) for pseudo,contrib in self.play_status[canal][2].items()]
         contribs_score={pseudo:int(10*contrib/nlettre) for pseudo,contrib in self.play_status[canal][2].items()}
         self.add_score(contribs_score)