seopardy/gamestate.py

29 lines
606 B
Python

from __future__ import print_function
class GameState(object):
def __init__(self, statefile=None):
pass
class QuestionAnswers(object):
def __init__(self, section, qnumber):
self.section = section
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])