seopardy/gamestate.py

29 lines
606 B
Python
Raw Normal View History

2013-11-06 20:42:00 +01:00
from __future__ import print_function
class GameState(object):
def __init__(self, statefile=None):
pass
2013-11-07 22:59:18 +01:00
2013-11-11 00:52:37 +01:00
class QuestionAnswers(object):
def __init__(self, section, qnumber):
2013-11-07 22:59:18 +01:00
self.section = section
2013-11-11 00:52:37 +01:00
self.qnumber = qnumber
self.nobody_answered = False
self.tries = []
def add_try(self, player, correct):
self.tries.append((player, correct))
def nobody_knew(self):
self.nobody_answered = True
def got_answered(self):
return not self.nobody_answered
def get_tries(self):
return self.tries
def is_answered(self):
return self.nobody_answered or any([c for (u, c) in self.tries])