def test(): grid = init_grid() #create_obstacle(grid, BOARD_SIZE[0]/2+6, BOARD_SIZE[0]/2+6, 3, 3) create_obstacle(grid, 4, 4, 1, 11) create_obstacle(grid, 6, 2, 2, 2) create_obstacle(grid, 10, 10, 3, 3) create_obstacle(grid, 4, 10, 3, 3) create_obstacle(grid, 4, 4, 3, 3) create_obstacle(grid, 10, 4, 3, 3) # 4 walls create_obstacle(grid, 0, 1, 1, BOARD_SIZE[0]) create_obstacle(grid, 0, 0, BOARD_SIZE[1], 1) create_obstacle(grid, 1, BOARD_SIZE[0], BOARD_SIZE[1], 1) create_obstacle(grid, BOARD_SIZE[1], 0, 1, BOARD_SIZE[0]) # creating ants ant_1 = ant(symbol=ANT_SYMBOL_1, location=STARTING_LOCATION_1, ID=1, state=NOT_FOUND) ant_2 = ant(symbol=ANT_SYMBOL_2, location=STARTING_LOCATION_2, ID=2, state=NOT_FOUND) place_ant_on_grid(grid, ant_1, STARTING_LOCATION_1) place_ant_on_grid(grid, ant_2, STARTING_LOCATION_2) print "ant 1 radius:" print_radius(ant_1) print "ant 2 radius:" print_radius(ant_2) print_grid(grid) for i in range(1,STEPS): # print grid[ant.radius[2*RIGHT+1][0],ant.radius[2*RIGHT+1][1]] if (ant_1.get_state() != FOUND_BASE and step(grid, ant_1) == 1): print "MEETING!" break if (ant_2.get_state() != FOUND_BASE and step(grid, ant_2) == 1): print "MEETING!" break print_grid(grid) else: print "NO MEETING!"
# 4 walls create_obstacle(grid, 0, 0, 1, BOARD_SIZE[1]) create_obstacle(grid, 0, 0, BOARD_SIZE[0], 1) create_obstacle(grid, 0, BOARD_SIZE[1], BOARD_SIZE[0], 1) create_obstacle(grid, BOARD_SIZE[0], 0, 1, BOARD_SIZE[1]) # creating ants ant_1 = ant(symbol=ANT_SYMBOL_1, location=STARTING_LOCATION_1) ant_2 = ant(symbol=ANT_SYMBOL_2, location=STARTING_LOCATION_2) place_ant_on_grid(grid, ant_1, STARTING_LOCATION_1) place_ant_on_grid(grid, ant_2, STARTING_LOCATION_2) print "ant 1 radius:" print_radius(ant_1) #print "ant 2 radius:" #print_radius(ant_2) print_grid(grid) for i in range(1,STEPS): # print grid[ant.radius[2*RIGHT+1][0],ant.radius[2*RIGHT+1][1]] if (step(grid, ant_1) == 1): print "MEETING!" break if (step(grid, ant_2) == 1): print "MEETING!" break print_grid(grid) else: print "NO MEETING!" #print ant.orientation #toggle_orientation_clockwise(ant) #print_radius(ant) #print ant.orientation