git.ucc.asn.au
/
progcomp2013.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Messing with log files
[progcomp2013.git]
/
qchess
/
src
/
main.py
diff --git
a/qchess/src/main.py
b/qchess/src/main.py
index
61e030b
..
cbc07f7
100644
(file)
--- a/
qchess/src/main.py
+++ b/
qchess/src/main.py
@@
-64,12
+64,12
@@
def main(argv):
global turn_delay
global agent_timeout
global turn_delay
global agent_timeout
- global log_file
+ global log_file
s
global src_file
global graphics_enabled
global always_reveal_states
global src_file
global graphics_enabled
global always_reveal_states
- max_
lin
es = None
+ max_
mov
es = None
src_file = None
style = "quantum"
src_file = None
style = "quantum"
@@
-116,24
+116,24
@@
def main(argv):
src_file = sys.stdin
else:
f = arg[2:].split("=")[1]
src_file = sys.stdin
else:
f = arg[2:].split("=")[1]
- if f[0
] == '@'
:
- src_file = HttpReplay(
"http://" + f.split(":")[0][1:]
)
+ if f[0
:7] == "http://"
:
+ src_file = HttpReplay(
f
)
else:
src_file = open(f.split(":")[0], "r", 0)
else:
src_file = open(f.split(":")[0], "r", 0)
- if len(f.split(":")) == 2:
-
max_lin
es = int(f.split(":")[1])
+
if len(f.split(":")) == 2:
+
max_mov
es = int(f.split(":")[1])
elif (arg[1] == '-' and arg[2:].split("=")[0] == "log"):
# Log file
if len(arg[2:].split("=")) == 1:
elif (arg[1] == '-' and arg[2:].split("=")[0] == "log"):
# Log file
if len(arg[2:].split("=")) == 1:
- log_file
= LogFile(sys.stdout
)
+ log_file
s.append(LogFile(sys.stdout)
)
else:
f = arg[2:].split("=")[1]
if f[0] == '@':
else:
f = arg[2:].split("=")[1]
if f[0] == '@':
- log_file
= HttpLog(f[1:]
)
+ log_file
s.append(ShortLog(f[1:])
)
else:
else:
- log_file
= LogFile(open(f, "w", 0
))
+ log_file
s.append(LogFile(open(f, "w", 0)
))
elif (arg[1] == '-' and arg[2:].split("=")[0] == "delay"):
# Delay
if len(arg[2:].split("=")) == 1:
elif (arg[1] == '-' and arg[2:].split("=")[0] == "delay"):
# Delay
if len(arg[2:].split("=")) == 1:
@@
-173,13
+173,15
@@
def main(argv):
if graphics_enabled:
sys.stderr.write(sys.argv[0] + " : (You won't get a GUI, because --file was used, and the author is lazy)\n")
return 44
if graphics_enabled:
sys.stderr.write(sys.argv[0] + " : (You won't get a GUI, because --file was used, and the author is lazy)\n")
return 44
- game = ReplayThread(players, src_file, end=end, max_
lines=max_lin
es)
+ game = ReplayThread(players, src_file, end=end, max_
moves=max_mov
es)
else:
board = Board(style)
else:
board = Board(style)
+ board.max_moves = max_moves
game = GameThread(board, players)
game = GameThread(board, players)
+
# Initialise GUI
if graphics_enabled == True:
try:
# Initialise GUI
if graphics_enabled == True:
try:
@@
-262,8
+264,8
@@
def main(argv):
error = game.error
error = game.error
-
if log_file != None and log_file != sys.stdout
:
- l
og_file
.close()
+
for l in log_files
:
+ l.close()
if src_file != None and src_file != sys.stdin:
src_file.close()
if src_file != None and src_file != sys.stdin:
src_file.close()
UCC
git Repository :: git.ucc.asn.au