import atexit, json
from lib2to3.pytree import Base
import os, sys, math
import numpy as np
from UTIL.tensor_ops import repeat_at, np_one_hot
from UTIL.config_args import ChainVar
from UTIL.network import TcpClientP2P

'''

'''
class ScenarioConfig(object):  
    '''

    '''
    # <Part 1> Needed by the hmp core #
    n_team1agent = 5

    N_TEAM = 1  

    N_AGENT_EACH_TEAM = [n_team1agent,]
    AGENT_ID_EACH_TEAM = [range(0,n_team1agent),]

    # Establish chain reaction
    N_AGENT_EACH_TEAM_cv = ChainVar(lambda n_team1agent: [n_team1agent,], chained_with=['n_team1agent'])
    AGENT_ID_EACH_TEAM_cv = ChainVar(lambda n_team1agent: [range(0,n_team1agent),], chained_with=['n_team1agent'])

    TEAM_NAMES = ['ALGORITHM.None->None',]
    '''

    '''
    ActAsUnity = False


    '''
    RewardAsUnity = True

    '''

 

'''

    if self.TS==0:
        # we expect all but one agents choose act1, only one agent choose act0
        # reward: 
        #   - Any agent choose act0: Team Reward +1
        #   - No agent choose act0: Team Reward +0
        reward = n_chosen_act0/self.n_agents

    Results:
          act0    act1
        [[9.9981e-01, 1.9052e-04],
         [9.9962e-01, 3.7964e-04],
         [9.9970e-01, 2.9723e-04],
         [9.9981e-01, 1.9268e-04],
         [9.9986e-01, 1.4075e-04]],
     _____________________________________________________________________________

        elif self.TS==1:  # Level 2
            # we expect all but one agents choose act1, only one agent choose act0
            # reward: 
            #   - Any agent choose act0: Team Reward +1
            #   - No agent choose act0: Team Reward +0
            reward = -1 if n_chosen_act0==0 else +1
            self.TS = 2
            ob = self.get_obs(TS=2)
        [[0.7883, 0.2117],
         [0.5876, 0.4124],
         [0.7635, 0.2365],
         [0.8501, 0.1499],
         [0.8389, 0.1611]],

     _____________________________________________________________________________

        elif self.TS==2:  # Level 3
            # we expect all but one agents choose act0, only one agent choose act1
            # reward: 
            #   - Any agent choose act1: Team Reward +1
            #   - No agent choose act1: Team Reward +0
            reward = -1 if n_chosen_act1==0 else +1
            self.TS = 3

          act0    act1
        [[0.3068, 0.6932],
         [0.3439, 0.6561],
         [0.3616, 0.6384],
         [0.3519, 0.6481],
         [0.3549, 0.6451]],
'''