def __init__(self, config_dir=settings.CONFIG_DIR, agent_id=0, port=6000, server_addr='localhost', num_opponents=0, num_teammates=0): self.hfo = HFOEnvironment() self.config_dir = config_dir self.port = port self.server_addr = server_addr self.status = IN_GAME
reward = 0 if can_kick and action in [DRIBBLE, SHOOT]: reward += 2 elif not can_kick and action == MOVE: reward += 2 if s == GOAL: return 10000 + reward elif s in [CAPTURED_BY_DEFENSE, OUT_OF_TIME, OUT_OF_BOUNDS]: return -10000 + reward else: return -3 + reward if __name__ == '__main__': hfo = HFOEnvironment() hfo.connectToServer(feature_set=HIGH_LEVEL_FEATURE_SET, server_port=6000) num_teammates = 0 num_opponents = 1 lr = 0.0005 n_games = 5 agent = DeepQAgent(gamma=0.99, epsilon=0, alpha=lr, input_dims=4, n_actions=3, mem_size=100000, batch_size=64, epsilon_end=0.0) agent.load_model() scores = []