コード例 #1
0
def test_controller():
    c = bc.GameController.new_manager(bc.GameMap.test_map())
    print(c.start_game(bc.Player(bc.Team.Red, bc.Planet.Earth)).to_json())
コード例 #2
0
gc.queue_research(bc.UnitType.Knight)

my_team = gc.team()

global one_loc, enemy_start


def invert(loc):
    inv_x = earth_map.width - loc.x
    inv_y = earth_map.height - loc.y
    return bc.MapLocation(bc.Planet.Earth, inv_x, inv_y)


# Lets analyse the map
# pm = bc.PlanetMap()
pl = bc.Player()
for planet in pl.planet:  # This is ob wrong, I only want to run the code if it is earth, but it has to run before the main loop starts. We can use a function I guess.
    if gc.planet() == bc.Planet.Earth:
        earth_map = gc.starting_map(bc.Planet.Earth)
        one_loc = gc.my_units()[0].location.map_location()
        enemy_start = invert(one_loc)
        print("Enemy starts at" + str(enemy_start.x) + " " +
              str(enemy_start.y))
        print("We start at" + str(one_loc.x) + " " + str(one_loc.y))


def mid_point(loc1, loc2):
    mid_x = int((loc1.x + loc2.x) / 2)
    mid_y = int((loc1.y + loc2.y) / 2)
    return bc.MapLocation(bc.Planet.Earth, mid_x, mid_y)