webgo/playgame.py

29 lines
No EOL
759 B
Python

import goban,helper,psql
def main(req,form):
"""
display selected goban and manage user input.
"""
req.write(str(form.keys())+"<hr>")
gamename = form["game"]
#do stuff
data = helper.header()
#read goban table from database
tmplist = psql.read_table(gamename)
#make a dictionary out of the list
gobandict = psql.fetchall_list_to_goban_dict(tmplist)
#print goban
#data += "<p> Turn number: %s, %s Player's Move.</p>" % (gobandict["turn_number"],("White","Black")[gobandict["turn_number"] % 2]) #eleet ;>
#check whether its our turn
#if yes: print 'your move' and display goban and process move
#if not: print '...s move' and display goban.
data += goban.display_goban(gobandict,req,form)
data += helper.footer()
req.write(data)