removed old and unused scripts
This commit is contained in:
parent
1b706ec81f
commit
65ed70815e
4 changed files with 4 additions and 61 deletions
|
@ -7,6 +7,10 @@ the init_webgo.main() in main.py reinitializes the whole database on each call,
|
||||||
comment the line out if you do not want that. init_webgo also creates two test users,
|
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.
|
gast and gast2. password = username. you can use those to log in.
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
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/.
|
||||||
|
------------------------------------------
|
||||||
some code snippets for reference:
|
some code snippets for reference:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
from mod_python import apache
|
|
||||||
|
|
||||||
def handler(req):
|
|
||||||
req.write("Hello World!")
|
|
||||||
return apache.OK
|
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
def init_goban(size=9):
|
|
||||||
"""
|
|
||||||
Returns an empty goban in the form of a dictionary where the keys are
|
|
||||||
x,y-tuples: (1,1) is the upper left corner, (9,9) the lower right one
|
|
||||||
for a 9x9 goban.
|
|
||||||
The additional key named size contains the length of a side of the goban.
|
|
||||||
Content of a field:
|
|
||||||
0 == empty field
|
|
||||||
1 == white stone on field
|
|
||||||
2 == black stone on field
|
|
||||||
Field turn_number: Current turn to be played. Even: white, uneven: black.
|
|
||||||
Optional argument size: define length of a side of the goban (one of
|
|
||||||
9, 12 or 19). Defaults to 9.
|
|
||||||
Returns dictionary.
|
|
||||||
"""
|
|
||||||
goban = {}
|
|
||||||
for x in range(1,size+1):
|
|
||||||
for y in range(1,size+1):
|
|
||||||
goban[(x,y)] = 0
|
|
||||||
if (size == 9) or (size == 13) or (size == 19):
|
|
||||||
goban["size"] = size
|
|
||||||
else:
|
|
||||||
goban["size"] = 9
|
|
||||||
goban["turn_number"] = 1
|
|
||||||
|
|
||||||
#some stones for testing purposes
|
|
||||||
goban[(1,2)] = 1; goban[(2,1)] = 1; goban[(2,3)] = 1; goban[(3,3)] = 1; goban[(6,7)] = 1; goban[(6,9)] = 1
|
|
||||||
goban[(2,2)] = 2; goban[(1,3)] = 2; goban[(4,7)] = 2; goban[(4,9)] = 2; goban[(5,8)] = 2; goban[(7,9)] = 2
|
|
||||||
|
|
||||||
return goban
|
|
||||||
|
|
||||||
|
|
||||||
def save_goban(goban):
|
|
||||||
"""gets a goban dictionary and pickles it to a file.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
f = open(picklefile,"w")
|
|
||||||
pickle.dump(goban,f)
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
print "error: could not write to file "+picklefile+"!"
|
|
||||||
|
|
||||||
def load_goban():
|
|
||||||
"""trys to load and return a pickled goban. If this does not work return
|
|
||||||
a newly initialized goban."""
|
|
||||||
try:
|
|
||||||
f = open(picklefile,"r")
|
|
||||||
return pickle.load(f)
|
|
||||||
f.close() #datei ist jetzt genullt
|
|
||||||
except:
|
|
||||||
return init_goban()
|
|
3
test.py
3
test.py
|
@ -1,3 +0,0 @@
|
||||||
def hello(req):
|
|
||||||
x = "Hello, world!"
|
|
||||||
return x
|
|
Loading…
Reference in a new issue