def main(): map_data = '' while True: current_line = input() if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) DoTurn(pw) pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): A = '' D = '{{{{},dns,{}},invs,{{{{{{},tms,{}},MCp,{{},pdie,{}}},invd,{{{},tms,{}},MCp,{{},pdie,{}}}},times,{{{{},nsim,{}},times,{{{},enshd,{}},MCp,{{{},pdin,{}},MCp,{{},pdie,{}}}}},min,{{{},nsim,{}},Pof,{{{{{},tms,{}},MCp,{{{},pdie,{}},MCp,{{},pdie,{}}}},invd,{{{},tms,{}},max,{{{},pdie,{}},invd,{{},pdie,{}}}}},max,{{{{},tms,{}},MCp,{{{},pdie,{}},MCp,{{},pdie,{}}}},invd,{{{},tms,{}},max,{{{},pdie,{}},invd,{{},pdie,{}}}}}}}}},MCp,{{{{{},tms,{}},MCp,{{},tms,{}}},invd,{{{{},tms,{}},max,{{},dsd,{}}},MCp,{{},pdie,{}}}},times,{{{{},nsim,{}},times,{{{},nsim,{}},times,{{{},enshd,{}},MCp,{{{},pdin,{}},MCp,{{},pdie,{}}}}}},min,{{{},nsim,{}},Pof,{{{{{},dns,{}},invs,{{{{},tms,{}},invd,{{{},tms,{}},MCp,{{{},pdie,{}},invd,{{},pdie,{}}}}},times,{{{{},nsim,{}},times,{{{{},nsim,{}},MCp,{{},gd,{}}},times,{{{{},enshd,{}},nega,{{},enshd,{}}},div,{{{},pdin,{}},MCp,{{},enshd,{}}}}}},min,{{{},nsim,{}},Pof,{{{{},nsim,{}},nega,{{{{{{{},nsim,{}},MCp,{{},gd,{}}},times,{{{},nsim,{}},MCp,{{},gd,{}}}},invd,{{{{},nsim,{}},gt,{{},nsim,{}}},invd,{{{},tms,{}},max,{{{},tms,{}},MCp,{{},nsim,{}}}}}},gt,{{},nep,{}}},gt,{{{{{{},nsim,{}},MCp,{{},gd,{}}},times,{{{},nsim,{}},MCp,{{},gd,{}}}},invd,{{{{{{},nsim,{}},lt,{{},pdie,{}}},gt,{{},nsim,{}}},invd,{{{},tms,{}},max,{{{},tms,{}},MCp,{{},nsim,{}}}}},div,{{{{{},nsim,{}},lt,{{},pdie,{}}},gt,{{},nsim,{}}},invd,{{{},tms,{}},max,{{{},tms,{}},MCp,{{{{},nsim,{}},MCp,{{},enshd,{}}},invd,{{{{},nsim,{}},times,{{{},enshd,{}},MCp,{{{},pdin,{}},MCp,{{},pdie,{}}}}},invd,{{{},tms,{}},max,{{{},pdie,{}},invd,{{},pdie,{}}}}}}}}}}},gt,{{},nep,{}}}}},min,{{{{{},nsim,{}},MCp,{{},enshd,{}}},invd,{{{{},nsim,{}},times,{{{},enshd,{}},MCp,{{{},pdin,{}},MCp,{{},pdie,{}}}}},invd,{{{},tms,{}},max,{{{},pdie,{}},invd,{{},pdie,{}}}}}},lt,{{},nep,{}}}}}}}},lt,{{},nep,{}}},min,{{{},amg,{}},Pof,{{},nep,{}}}}}}}}},times,{{{},gd,{}},div,{{},dsd,{}}}}' E = DTGT(D) while True: B = input() if len(B) >= 2 and B.startswith('go'): C = PlanetWars(A) DTu(C, E) C.FinishTurn() A = '' else: A += B + '\n'
def main(): debug("starting") map_data = '' while (True): current_line = raw_input() if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) debug("NEW TURN") DoTurn(pw) pw.FinishTurn() debug("TURN FINISHED") map_data = '' else: map_data += current_line + '\n'
def main(): Alpha = float(sys.argv[1]) Gamma = float(sys.argv[2]) DatabaseLocation = sys.argv[3] map_data = '' TurnNumber = 0 while (True): current_line = raw_input() if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) TurnNumber = DoTurn(pw, TurnNumber, Alpha, Gamma, DatabaseLocation) pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): f = open('MyBot2.log', 'w') group_ids = [] if '-g' in sys.argv: group_ids = [int(k) for k in sys.argv[2].split(',')] f.write('group: ' + str(group_ids) + '\n') map_data = '' while (True): current_line = raw_input() f.write(current_line + '\n') if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) f.write('--------------- NEW TURN ----------------------------\n') DoTurn(pw, group_ids, f) f.write('-----------------------------------------------------\n') pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): global theta abs_path = os.path.dirname(os.path.abspath(__file__)) print "cwd:", os.path.dirname(os.path.abspath(__file__)) print "\r\n\r\n" with open(os.path.join(abs_path, "theta.txt")) as f: line = f.readline().split(" ") theta = map(lambda x: float(x), line) #endwith debug("starting") map_data = '' while True: current_line = raw_input() if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) DoTurn(pw) pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): f = open('MyBot3.log', 'w') nickname = 'X' if '-g' in sys.argv: group_ids = [int(k) for k in sys.argv[2].split(',')] if '-n' in sys.argv: nickname = str(sys.argv[4]) f.write('group: ' + str(group_ids) + '\n') f.write('nick: ' + str(nickname) + '\n') map_data = '' while(True): current_line = raw_input() f.write(current_line + '\n') if len(current_line) >= 1 and current_line.startswith("."): pw = PlanetWars(map_data) DoTurn(pw, group_ids, nickname) pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): map_data = '' turn = 0 try: while(True): current_line = input() #debug("-> %s" % current_line, 'server') if len(current_line) >= 2 and current_line.startswith("go"): debugger.debug("# %d" % turn) pw = PlanetWars(map_data) DoTurn(pw) #debug("Answer is sent.", 'server') pw.FinishTurn() turn += 1 map_data = '' else: map_data += current_line + '\n' except Exception as e: debugger.debug(e, "error") debugger.debug("The End!")
def main(): import sys global theta if len(sys.argv) >= NUMBER_OF_FEATURES: debug("theta from commandline args") theta = sys.argv[1:] new_list = [] for element in theta: new_list.append([float(element)]) theta = new_list else: debug("random theta") # theta = [1.07668319, -4.67252562, -4.83999886, -3.78736198, -2.50656436, 3.8234228, 0.2380] theta = [ 0.25499724, -0.03653183, -0.04419227, -0.34623976, 0.67157856, 0.39569266, 0.05, 0.27693781, 0.5 ] # endif debug("starting for theta: {0}".format(str(theta))) # with open("results.txt", "a+") as f: # for i in range(NUMBER_OF_FEATURES): # elem = theta[i][0] # f.write("{0} ".format(elem)) map_data = '' while True: current_line = raw_input() if len(current_line) >= 2 and current_line.startswith("go"): pw = PlanetWars(map_data) DoTurn(pw) pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'
def main(): group_ids = [] nickname = 'X' mz_map_edit = False my_id = -1 if '-g' in sys.argv: group_ids = [int(k) for k in sys.argv[2].split(',')] if '-n' in sys.argv: nickname = str(sys.argv[4]) if '-mz' in sys.argv: mz_map_edit = True f = open('MyBot4_' + str(nickname) + '.log', 'w') f.write('group: ' + str(group_ids) + '\n') f.write('nick: ' + str(nickname) + '\n') map_data = '' while (True): current_line = raw_input() f.write(current_line + '\n') if len(current_line) >= 1 and current_line.startswith("."): if mz_map_edit: tmp_map = '' lines = map_data.split("\n") if my_id < 0: for line in lines: line = line.split("#")[0] tokens = line.split(" ") if tokens[0] == "Y": if len(tokens) == 2: my_id = int(tokens[1]) f.write('my_id: ' + str(my_id) + '\n') for line in lines: line = line.split("#")[0] # remove comments tokens = line.split(" ") if tokens[0] == "P": if len(tokens) == 7: new_line = line if int(tokens[5]) == my_id: # stdout.write('1-- ' + "\n") new_line = "P " + str(tokens[1]) + " " + str( float(tokens[2])) + " " + str( float(tokens[3])) + " " + str( int(tokens[4])) + " " + str( 1) + " " + str(int(tokens[6])) new_line = new_line.replace(".0 ", " ") elif int(tokens[5]) == 1: # stdout.write('2-- ' + "\n") new_line = "P " + str(tokens[1]) + " " + str( float(tokens[2])) + " " + str( float(tokens[3])) + " " + str( int(tokens[4])) + " " + str( my_id) + " " + str( int(tokens[6])) new_line = new_line.replace(".0 ", " ") tmp_map += new_line + '\n' else: tmp_map += line + '\n' # stdout.write(str(tmp_map)+ "\n") map_data = tmp_map pw = PlanetWars(map_data) f.write('-------------- NEW TURN ----------------\n') DoTurn(pw, group_ids, nickname, f) f.write('----------------------------------------\n') pw.FinishTurn() map_data = '' else: map_data += current_line + '\n'