X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fsrc%2Fmain.py;h=90deec7865085d80b8d141e22e70cb0cb9fa6a67;hp=f52cad083ea372490af83a4cb104625cc667c890;hb=64978647120812a13948e2146de81281b38a54d5;hpb=df2c20df9b55fd3ab24c494d745a260662f1da67;ds=sidebyside diff --git a/qchess/src/main.py b/qchess/src/main.py index f52cad0..90deec7 100644 --- 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 + #print str(s) 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": - port = 4563 + port += 1 elif colour == "white": - port = 4563 + port += 1 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]) - + + 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: @@ -289,6 +299,13 @@ def main(argv): sys.stdout.write(game.final_result + "\n") return error + + + + + + + # This is how python does a main() function... if __name__ == "__main__":