This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.lib import features, point, actions, units | |
from pysc2.env.environment import TimeStep, StepType | |
from pysc2.env import sc2_env, available_actions_printer | |
from pysc2 import run_configs | |
from s2clientprotocol import sc2api_pb2 as sc_pb | |
import importlib | |
import random | |
import sys | |
import glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
class SelectedUnitsHead(tf.keras.layers.Layer): | |
def __init__(self): | |
super(SelectedUnitsHead, self).__init__() | |
self.model = tf.keras.layers.Dense(256, activation='relu') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
class ResBlock_MLP(tf.keras.layers.Layer): | |
def __init__(self, output_dim, **kwargs): | |
self.shortcut = tf.keras.layers.Dense(256, activation='relu') | |
self.mlp_0 = tf.keras.layers.Dense(256, activation='relu') | |
self.mlp_1 = tf.keras.layers.Dense(256, activation='relu') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.env import sc2_env, available_actions_printer | |
from pysc2.lib import actions, features, units | |
from utils import get_entity_obs, get_upgrade_obs, get_gameloop_obs, get_race_onehot, get_agent_statistics | |
from network import Core, ActionTypeHead, SelectedUnitsHead, TargetUnitHead, LocationHead | |
from absl import flags | |
FLAGS = flags.FLAGS | |
FLAGS(sys.argv) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.env import sc2_env, available_actions_printer | |
from pysc2.lib import actions, features, units | |
import sys | |
import units_new | |
import upgrades_new | |
from utils import get_entity_obs, get_upgrade_obs, get_gameloop_obs, get_race_onehot, get_agent_statistics | |
from network import EntityEncoder, ScalarEncoder, SpatialEncoder, Core | |
map_name = 'Simple128' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.env import sc2_env, available_actions_printer | |
from pysc2.lib import actions, features, units | |
from utils import get_entity_obs, get_upgrade_obs, get_gameloop_obs, get_race_onehot, get_agent_statistics | |
from network import EntityEncoder, ScalarEncoder, SpatialEncoder, Core | |
from absl import flags | |
FLAGS = flags.FLAGS | |
FLAGS(sys.argv) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def get_spatial_obs(feature_screen): | |
spatial_input = np.reshape(feature_screen, [1,128,128,27]) | |
return spatial_input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.lib import actions, features, units | |
import numpy as np | |
import upgrades_new | |
import math | |
def get_agent_statistics(score_by_category): | |
score_by_category = score_by_category.flatten() | |
agent_statistics = np.log(score_by_category + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pysc2.lib import actions, features, units | |
import numpy as np | |
import units_new | |
import math | |
def get_entity_obs(feature_units): | |
unit_type = [] | |
alliance = [] | |
current_health = [] | |
current_shields = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiagent import Agent | |
from pysc2.env import sc2_env, available_actions_printer | |
def get_supervised_agent(race): | |
supervissed_agent = Agent('Terran', None) | |
return supervissed_agent | |
class ActorLoop: |
NewerOlder