Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add debug, add correctly_answered

  • Loading branch information...
commit 0d4ff5c75055c8a0ea60c495c9258b9c6c313b25 1 parent 848aba8
@pedantic-git pedantic-git authored
Showing with 7 additions and 1 deletion.
  1. +5 −0 src/Hunt.py
  2. +2 −1  src/rich-testenv.py
View
5 src/Hunt.py
@@ -39,6 +39,7 @@ def start(self):
self.put()
self.setup_clues()
for t in self.teams:
+ logging.debug("Clues for team %s: %s" % (t.name, [c.question for c in t.clues()]))
t.send_clue('First clue: ')
def setup_clues(self):
@@ -144,6 +145,10 @@ def has_clue_left(self, c):
"""Returns true if team has given clue left to answer."""
return c.key().id() in self.clue_keys
+ def correctly_answered(self, c):
+ """Returns true if team correctly answered given clue."""
+ return bool(Success.all().filter('team =', self).filter('clue =', c).fetch(1))
+
def pass_clue(self):
"""Quit the current clue permanently in order not to get
stuck. No Success object is added."""
View
3  src/rich-testenv.py
@@ -34,6 +34,7 @@ def print_clues(hunt):
print "Remaining clues: %d" % t.remaining()
print "Score: %d" % t.score()
print "Has chair clue? %s" % t.has_clue_left(chair)
+ print "Correctly answered chair clue? %s" % t.correctly_answered(chair)
print ""
print "Content-Type: text/plain\n"
@@ -49,7 +50,7 @@ def print_clues(hunt):
for t in h.teams:
print "%s guesses 'PURPLE'" % t.name
- result = Team.deliver(t.phone, "A PURPLE")
+ result = Team.deliver(t.phone, "PURPLE")
print "Correct!" if result else "Wrong!"
print ""
Please sign in to comment.
Something went wrong with that request. Please try again.