2005-09-06 20:22:34 +02:00
|
|
|
------------------------------------------
|
|
|
|
developers only! this game is currently not playable!
|
2005-09-06 19:52:46 +02:00
|
|
|
|
2005-09-06 20:22:34 +02:00
|
|
|
main.py is the main script. call this from a browser.
|
2005-09-06 19:52:46 +02:00
|
|
|
|
2005-09-06 20:22:34 +02:00
|
|
|
the init_webgo.main() in main.py reinitializes the whole database on each call, so
|
|
|
|
comment the line out if you do not want that. init_webgo also creates two test users,
|
|
|
|
gast and gast2. password = username. you can use those to log in.
|
|
|
|
------------------------------------------
|
2005-09-06 20:30:58 +02:00
|
|
|
want to create your own goban images? Simple: just replace the images in
|
|
|
|
imgsource/ with the desired ones. then run generate_goban_images.py and
|
|
|
|
the new images get written to img/.
|
|
|
|
------------------------------------------
|
2005-09-06 21:04:28 +02:00
|
|
|
overview of the files:
|
|
|
|
main.py - the main script. Essentially a wrapper that prints the
|
|
|
|
traceback if something went wrong.
|
|
|
|
login.py - this file contains functions for login and game
|
|
|
|
selection/modification.
|
|
|
|
goban.py - code for displaying a goban as a html page.
|
|
|
|
psql.py - all functions directly accessing the database.
|
|
|
|
init_webgo.py - re-initialize the whole game. deletes everything and
|
|
|
|
sets some defaults.
|
|
|
|
helper.py - small functions for string manipulation etc.
|
|
|
|
generate_goban_images.py
|
|
|
|
- recreate the goban images. just run from console.
|
|
|
|
|
|
|
|
------------------------------------------
|
|
|
|
coding guidelines
|
|
|
|
tab == 4 whitespaces.
|
|
|
|
function names are lowercase with _ as a seperator.
|
|
|
|
------------------------------------------
|
2005-09-06 20:22:34 +02:00
|
|
|
some code snippets for reference:
|
2005-09-06 19:52:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
How to make the goban clickable:
|
|
|
|
data += '<form method="post">'
|
|
|
|
data += '<input type=image src="img/bottomrightline.png" name="untenrechts">'
|
|
|
|
#insert rest of goban here
|
|
|
|
data += '</form>'
|
|
|
|
print data
|
|
|
|
|
2005-09-06 20:22:34 +02:00
|
|
|
How to extract the data from this POST with the cgi module:
|
2005-09-06 19:52:46 +02:00
|
|
|
import cgi
|
|
|
|
#get instance of fieldstorage
|
|
|
|
form = cgi.FieldStorage()
|
|
|
|
#if form == empty (which means if page is displayed for the first time):
|
|
|
|
if form.keys() != []:
|
|
|
|
#cut out the name of the clicked button
|
2005-09-06 20:22:34 +02:00
|
|
|
print string.split(form.keys()[0],".x")[0]
|
|
|
|
|
|
|
|
------------------------------------------
|