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
Making dedicated match making server
[progcomp2013.git]
/
qchess
/
src
/
main.py
diff --git
a/qchess/src/main.py
b/qchess/src/main.py
index
f52cad0
..
90deec7
100644
(file)
--- a/
qchess/src/main.py
+++ b/
qchess/src/main.py
@@
-27,14
+27,18
@@
def make_player(name, colour):
if s[0] == "network":
ip = None
port = 4562
if s[0] == "network":
ip = None
port = 4562
+ #print str(s)
if len(s) > 1:
if len(s) > 1:
- ip = s[1]
+ if s[1] != "":
+ ip = s[1]
+ if len(s) > 2:
+ port = int(s[2])
if ip == None:
if colour == "black":
if ip == None:
if colour == "black":
- port
= 4563
+ port
+= 1
elif colour == "white":
elif colour == "white":
- port
= 4563
+ port
+= 1
return NetworkPlayer(colour, Network((ip, port)), None)
if s[0] == "internal":
return NetworkPlayer(colour, Network((ip, port)), None)
if s[0] == "internal":
@@
-135,7
+139,13
@@
def main(argv):
if len(f.split(":")) == 2:
max_moves = int(f.split(":")[1])
if len(f.split(":")) == 2:
max_moves = int(f.split(":")[1])
-
+
+ elif (arg[1] == '-' and arg[2:] == "server"):
+ if len(arg[2:].split("=") <= 1):
+ dedicated_server()
+ else:
+ client(arg[2:].split("=")[1])
+ sys.exit(0)
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:
@@
-289,6
+299,13
@@
def main(argv):
sys.stdout.write(game.final_result + "\n")
return error
sys.stdout.write(game.final_result + "\n")
return error
+
+
+
+
+
+
+
# This is how python does a main() function...
if __name__ == "__main__":
# This is how python does a main() function...
if __name__ == "__main__":
UCC
git Repository :: git.ucc.asn.au