def twitter_battle(call_prompt, boss): # add on followers and amt later ''' Input: boss (boss kw) and prompt (player kw) Output: rhymes_diff, ats_diff ''' boss_ats = TW.recent_tweets([boss],2)[1] boss_rhymes = TW.recent_tweets([boss],2)[2] player_ats = TW.recent_tweets([call_prompt],3)[1] player_rhymes = TW.recent_tweets([call_prompt],3)[2] ats_diff = player_ats - boss_ats rhymes_diff = player_rhymes - boss_rhymes print "Rhyme-Count from battle:", rhymes_diff print "Holler-Ats from battle:",ats_diff if ats_diff > 0: ats_winner = 'player' elif ats_diff == 0: ats_winner = 'equal' else: ats_winner = 'boss' if rhymes_diff >0: rhymes_winner = 'player' elif rhymes_diff ==0: rhymes_winner = 'equal' else: rhymes_winner = 'boss' #add in check for followers here. for scen in g_map.scenario: if scen.attrs.get('rhymes') == rhymes_winner and scen.attrs.get('ats')==ats_winner: print scen.value return rhymes_diff, ats_diff #returns to twitter_data
def battle(boss_kw, call_prompt): ''' Input: boss_kw and prompt for 'call' or 'gang call' Output: ''' boss_ats = retweets()[1] boss_hashes = retweets()[2] player_ats = TW.recent_tweets([call_prompt],1)[1] player_hashes = TW.recent_tweets([call_prompt],1)[2] ats_diff = player_ats - boss_ats hashes_diff = player_hashes - boss_hashes print "Hash from battle:", hashes_diff print "Holler-Ats from battle:",ats_diff if ats_diff > 0: ats_winner = 'player' elif ats_diff == 0: ats_winner = 'equal' else: ats_winner = 'boss' if hashes_diff >0: hashes_winner = 'player' elif hashes_diff ==0: hashes_winner = 'equal' else: hashes_winner = 'boss' print battles[(ats_winner,hashes_winner)].desc[0].value return hashes_diff, ats_diff
def battle(boss_kw, call_prompt): boss_ats = retweets()[1] boss_hashes = retweets()[2] player_ats = TW.recent_tweets([call_prompt],1)[1] player_hashes = TW.recent_tweets([call_prompt],1)[2] ats_diff = player_ats - boss_ats hashes_diff = player_hashes - boss_hashes if boss_ats == player_ats: if player_hashes == boss_hashes: print "It's a draw!" elif player_hashes > boss_hashes: print "You smoked them out!" elif boss_hashes > player_hashes: print "They smoked you out!" print "You lose", hashes_diff, "of your stash." elif boss_ats > player_ats: if player_hashes == boss_hashes: print "They're packing the same hashes!" print "Run brother, run!!" elif player_hashes > boss_hashes: print "They got a big crew, but you smoked them out!" print "Add the difference to your stack! And roll on back!" elif boss_hashes > player_hashes: print "They smoked you out! And you couldn't fight!" print "And you lose", ats_diff,"of your holler @s." print "You lose", hashes_diff, "of your stash." elif boss_ats < player_ats: print "You out hollered them. You mad tweeter, you!" if player_hashes == boss_hashes: print "You sly mother. You beat that turkey!" elif player_hashes > boss_hashes: print "You smoked them out, too!" elif boss_ats > player_ats: print "They smoked you out!" print "You lose", hashes_diff, "of your stash." return ats_diff, hashes_diff
def retweets(): #returns ats and hashes of most recent retweet tweets, ats, hashes= TW.recent_tweets(['RT'], 1) return tweets, ats, hashes