]> gitweb.pimeys.fr Git - bots/hung.git/commitdiff
Fail float/int + compter le bonus qu'on annonce, c'est mieux master
authorVincent Le Gallic <legallic@crans.org>
Fri, 7 Jul 2017 12:40:44 +0000 (14:40 +0200)
committerVincent Le Gallic <legallic@crans.org>
Fri, 7 Jul 2017 12:40:44 +0000 (14:40 +0200)
hung.py

diff --git a/hung.py b/hung.py
index 52f725b4d6d1a112ca43199be962d04bdb8e865f..2c3e7086dbb9955b8b5e970cf8e30a1a5b736911 100755 (executable)
--- a/hung.py
+++ b/hung.py
@@ -531,7 +531,7 @@ class Hung(ircbot.SingleServerIRCBot):
         realword = self.reveal_word(serv, canal)
         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()}
+        contribs_score={pseudo:int(10.0*contrib/nlettre)+(bonusvalue*(bonus==pseudo)) for pseudo,contrib in self.play_status[canal][2].items()}
         self.add_score(contribs_score)
         serv.privmsg(canal,"Contributions : %s"%("  ".join(contribs)) )
         self.play_status[canal]=[None,None,None]