コード例 #1
0
ファイル: bot2.py プロジェクト: TJuberg/TIHriva
		max = 0
		key = "nobody"
		for x in scores:
			if scores[x] > max:
				max = scores[x]
				key = x
		if max > 0:
			bot_say("%s has the top score: %d" % (key, max))

		bot_say("cya later ~")

		sys.exit(1)


	if time.time() >= hint_timer and waiting==1:	
		hint = hints.make_hint(heuristic.plain_question(ans[qnums[qid]]))
		bot_say("Hint: %s" % hint)
		hint_timer = time.time() + 10
		throttle = time.time() + 3

	if time.time() >= score_throttle and do_scores:
		if sum(scores.values()) == 0:
			bot_say("No score yet")
		else:
			bot_say("Scores")
			for player in sorted(scores, key=scores.get, reverse=True):
				if scores[player] > 1:
					bot_say("%s: %d points" % (player, scores[player]))
				elif scores[player] > 0:
					bot_say("%s: %d point" % (player, scores[player]))
コード例 #2
0
ファイル: bot2.py プロジェクト: AMorporkian/quizclown
				if stfu[user] == 1:
					bot_say("%s: please just type your answers, without typing my name" % user)
				elif stfu[user] == 2:
					bot_say("%s: for the second time, please do not type my name like that. I ignore these lines." % user)


	# Done with the questions, reshuffle and restart
	if question_number >= qc:
		bot_say("Reshuffling questions ...")
		shuffle_questions()
		question_number = 0
		state = ASK_QUESTION
		rs_throttle = time.time() + 150

	if time.time() >= hint_timer and state==WAIT_ANSWER:	
		hint = hints.make_hint(heuristic.plain_question(ans[qnums[question_number]]))
		bot_say("Hint: %s" % hint)
		hint_timer = time.time() + 12
		hint_throttle = time.time() + 3

	if time.time() >= score_throttle and do_scores:
		if sum(scores.values()) == 0:
			bot_say("No score yet")
		else:
			n = 0
			scorebuf = "Scores -- "

			for player in sorted(scores, key=scores.get, reverse=True):
				if scores[player] > 1:
					scoreline = "%s: %d pts" % (player, scores[player])
				elif scores[player] > 0: