diff --git a/Code/irc/banterbot.py b/Code/irc/banterbot.py index 7bfbc6e..8575ffe 100755 --- a/Code/irc/banterbot.py +++ b/Code/irc/banterbot.py @@ -74,8 +74,24 @@ def score_banter(channel, user, messageText): ircsock.send("PRIVMSG " + channel + " :" + msg + "\n") +def get_new_banter(channel, user): + with open("/usr/share/dict/words", "r") as dict: + words = filter(lambda word:re.search(r"ant", word), dict.readlines()) + words = filter(lambda word:re.search(r"^[^']*$", word), words) + random.shuffle(words) + word = words[0].strip("\n") + start = word.find('ant') + if(start == 0): + word = 'b' + word + else: + if('aeiou'.find(word[start]) > -1): #just append a 'b' + word = word[:start] + 'b' + word[start:] + else: #replace the letter with 'b' + word = word[:start-1] + 'b' + word[start:] + ircsock.send("PRIVMSG " + channel + " :" + user + ": Here, why don't you try '" + word + "'?\n") + def rollcall(channel): - ircsock.send("PRIVMSG "+ channel +" :U wot m8? I score all the top drawer #banter and #bantz on this channel!\n") + ircsock.send("PRIVMSG "+ channel +" :U wot m8? I score all the top drawer #banter and #bantz on this channel! Find new top-shelf banter with !newbanter\n") def connect(server, channel, botnick): ircsock.connect((server, 6667)) @@ -118,6 +134,9 @@ def listen(): if ircmsg.find("#banter") != -1 or ircmsg.find("#bantz") != -1: score_banter(channel, user, messageText) + if ircmsg.find(":!newbanter") != -1: + get_new_banter(channel, user) + if ircmsg.find(":!rollcall") != -1: rollcall(channel) diff --git a/Code/irc/tildescores.txt b/Code/irc/tildescores.txt index 1847e3a..df893ec 100644 --- a/Code/irc/tildescores.txt +++ b/Code/irc/tildescores.txt @@ -1,12 +1,16 @@ krowbar&^%7&^%1421953955 -karlen&^%11&^%1421948093 -endorphant&^%14&^%1421954148 -jumblesale&^%10&^%1421943491 -marcus&^%10&^%1421954915 -papa&^%3&^%1421936555 +karlen&^%13&^%1422027689 +endorphant&^%26&^%1422033378 +jumblesale&^%18&^%1422027769 +marcus&^%12&^%1421960027 +papa&^%5&^%1422029014 epicmorphism&^%3&^%1421937744 -audy&^%9&^%1421950247 -kc&^%2&^%1421890581 +audy&^%13&^%1422034301 +kc&^%5&^%1421975132 vilmibm&^%3&^%1421887627 -cmr&^%1&^%1421888980 -imt&^%4&^%1421953072 +cmr&^%4&^%1421989946 +imt&^%12&^%1422014172 +cndorphant&^%22&^%1422033254 +rain&^%4&^%1422034265 +sl2c&^%5&^%1422006813 +leni&^%2&^%1421978450 diff --git a/Code/irc/topicscores.txt b/Code/irc/topicscores.txt index a0915bf..4738647 100644 --- a/Code/irc/topicscores.txt +++ b/Code/irc/topicscores.txt @@ -2,4 +2,4 @@ krowbar&^%21&^%22 um&^%11&^%8 kc&^%0&^%22 marcus&^%3&^%1 -khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1karlen&^%0&^%1 \ No newline at end of file +khoi&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1jumblesale&^%1&^%0karlen&^%0&^%1karlen&^%0&^%1karlen&^%0&^%1dan&^%1&^%0datagrok&^%0&^%1vilmibm&^%0&^%1papa&^%1&^%0vilmibm&^%1&^%0vilmibm&^%0&^%1jumblesale&^%1&^%0selfsame&^%1&^%0karlen&^%0&^%1jumblesale&^%0&^%1karlen&^%0&^%1vilmibm&^%0&^%1vilmibm&^%0&^%1 \ No newline at end of file diff --git a/Code/irc/wangbot.py b/Code/irc/wangbot.py index 521c9d1..fdb378a 100755 --- a/Code/irc/wangbot.py +++ b/Code/irc/wangbot.py @@ -30,9 +30,9 @@ parser.add_option("-n", "--nick", dest="nick", default='numberwang_bot', (options, args) = parser.parse_args() p = inflect.engine() -LIMIT_GUESSING = True -MIN_ROUNDS = 2 -MAX_ROUNDS = 4 +LIMIT_GUESSING = False +MIN_ROUNDS = 5 +MAX_ROUNDS = 12 SCORE_FILE = "numberwangscores.txt" SHOW_TOP_NUM = 5 @@ -154,17 +154,18 @@ def save_scores(): scores = scorefile.readlines() scorefile.seek(0) scorefile.truncate() - for name in currentScores: - found = False - for line in scores: + for line in scores: + for name in currentScores: score = line.strip("\n").split("&^%") if(score[0] == name): - found = True line = score[0] + "&^%" + str(int(score[1]) + currentScores[name]) + "\n" - scorefile.write(line) - if(not found): - line = name + "&^%" + str(currentScores[name]) + "\n" - scorefile.write(line) + currentScores.remove(name) + break + scorefile.write(line) + + for name in currentScores: #new wangers + line = name + "&^%" + str(currentScores[name]) + "\n" + scorefile.write(line) def show_highscores(channel): with open(SCORE_FILE, "r") as scorefile: