예제 #1
0
                        if state_array[k, j, i] != next_array[k, j, i]:
                            logging.info(('Error at ', (i, j, k)))
                            logging.info(('... Expected ', next_array[k, j,
                                                                      i]))
                            logging.info(('... Got      ', state_array[k, j,
                                                                       i]))

    action = np.random.randint(0, 7, (gmap.height, gmap.width))

    logging.info('--------------- ACTIONS -----------------')

    for ship in me.get_ships():
        i, j = ship.position.x, ship.position.y
        a = action[j, i]
        logging.info((i, j, a))

        if a < 4:
            mv = hlt.Direction.get_all_cardinals()[a]
            commands.append(ship.move(mv))
        elif a == 4 and not gmap[ship].structure:
            commands.append(ship.make_dropoff())
        else:
            commands.append(ship.stay_still())

    if action[me.shipyard.position.y, me.shipyard.position.x] == 6:
        commands.append(me.shipyard.spawn())

    next = sim.next_state(state, action)

    game.end_turn(commands)