game overview now works using clearsilver.
This commit is contained in:
parent
34420b0598
commit
6abbcee533
6 changed files with 99 additions and 131 deletions
51
playgame.py
51
playgame.py
|
@ -27,6 +27,7 @@ def create_gobandict(req,form,gamename):
|
|||
gets a gamename
|
||||
loads sgf, transforms it to dict, writes stuff like player names to dict
|
||||
returns dict
|
||||
TODO: is this function still in use?
|
||||
"""
|
||||
#read goban sgf from database
|
||||
mygame = database.GobanTable.byName(gamename)
|
||||
|
@ -39,56 +40,6 @@ def create_gobandict(req,form,gamename):
|
|||
gobandict["sgf"] = sgf
|
||||
return gobandict
|
||||
|
||||
def main(req,form):
|
||||
"""
|
||||
display selected goban and manage user input.
|
||||
"""
|
||||
|
||||
try:
|
||||
gamename = form["game"]
|
||||
except:
|
||||
gamename = ""
|
||||
if gamename != "":
|
||||
data = ""
|
||||
req.write(helper.header())
|
||||
#helper.debug(req,form,str(form.keys()))
|
||||
gobandict = create_gobandict(req,form,gamename)
|
||||
#check if user has already clicked onto a field:
|
||||
click_on_field = False
|
||||
for item in form.keys():
|
||||
if string.find(item,").x") > 0:
|
||||
click_on_field = True
|
||||
if click_on_field:
|
||||
#if yes: is this the user's turn? then process form.
|
||||
if is_my_turn(req,form,gobandict):
|
||||
helper.debug(req,form,"its my turn , i am going to process the form: --")
|
||||
retstring = goban.process_form(req,form,gobandict)
|
||||
if retstring != "":
|
||||
helper.debug(req,form,"playgame.main says: "+str(retstring))
|
||||
else:
|
||||
#reload gobandict, it has been changed.
|
||||
gobandict = create_gobandict(req,form,gamename)
|
||||
|
||||
else:
|
||||
helper.debug(req,form,"it's not my turn.")
|
||||
data += """<br>Turn number: %s. %s plays.\n
|
||||
""" % (str(gobandict["turn_number"]), (string.capitalize(gobandict["play"])))
|
||||
|
||||
#check whether its our turn
|
||||
#if yes: print 'your move' and display goban and process move
|
||||
#if not: print '...s move' and display goban.
|
||||
if is_my_turn(req,form,gobandict):
|
||||
data += "<br>It's your turn.<br>\n"
|
||||
else:
|
||||
data += "<br>This is not your turn. You have to wait for the move of the other player.<br>\n"
|
||||
#print goban
|
||||
data += goban.display_goban(gobandict,req,form)
|
||||
data += login.navigation_bar(req,form)
|
||||
data += helper.footer(req,form,1)
|
||||
req.write(data)
|
||||
|
||||
else:
|
||||
req.write('Error: You have to select a game to play it!')
|
||||
|
||||
class PlayGame:
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue