예제 #1
0
파일: Player.py 프로젝트: DanaL/crashRun
    def __init__(self,stats,background,name,row,col,dm):
        self.dm = dm
        self.__xp = 0
        self.level = 1
        self.skill_points = 0
        self.time_since_last_hit = 1000
        self.stats = stats

        self.light_radius = 5
        self.__hp_roll = 8
        self.__MAX_LEVEL = 25
    
        self.max_hp = 0
        self.curr_hp = 0
        self.temp_bonus_hp = 0
        
        self.background = background
        BaseAgent.__init__(self,12,10,1,2,'@','white','black','white',name,row,col,'')
    
        self.__calc_initial_hp()
        self.calc_ac()
        self.__calc_next_level()
        self.events = []
        self.software = Wetboard(3,10)
        self.weapon_configs = {}
예제 #2
0
파일: Player.py 프로젝트: DanaL/crashRun
 def remove_effects(self, source):
     BaseAgent.remove_effects(self, source)
     self.dm.refresh_player_view()
예제 #3
0
파일: Player.py 프로젝트: DanaL/crashRun
 def remove_effect(self, effect, source):
     BaseAgent.remove_effect(self, effect, source)
     
     if effect[0] == 'dazed' and not self.has_condition('dazed'):
         self.dm.alert_player(self.row, self.col, "You shake off your daze.")
     self.dm.dui.update_status_bar()
예제 #4
0
파일: Player.py 프로젝트: DanaL/crashRun
 def check_for_expired_conditions(self):
     if BaseAgent.check_for_expired_conditions(self):
         self.dm.alert_player(self.row, self.col, 'You are coming down a bit.')
예제 #5
0
파일: Player.py 프로젝트: DanaL/crashRun
 def apply_effect(self, effect, instant):
     BaseAgent.apply_effect(self, effect, instant)
     if effect[0][0] in ('infrared','light'):
         self.dm.refresh_player_view()
     self.dm.dui.update_status_bar()
예제 #6
0
파일: Player.py 프로젝트: DanaL/crashRun
 def calc_cyberspace_ac(self):
     BaseAgent.calc_cyberspace_ac(self, 10)
예제 #7
0
파일: Player.py 프로젝트: DanaL/crashRun
 def add_hp(self, delta):
     BaseAgent.add_hp(self, delta)
     self.dm.dui.update_status_bar()
예제 #8
0
class TestBaseAgent(unittest.TestCase):
    """
    This class testes the base supervisor
    """
    def __init__(self, *args, **kwargs):
        super(TestBaseAgent, self).__init__(*args, **kwargs)
        self.N = np.random.randint(1, 100)
        self.s = BaseSupervisor(self.N)
        self.a = BaseAgent(0, self.s)

    def test_log(self):
        """
        Tests that the log is updated correctly
        """
        self.a.decision_fct = DecisionLogicTesting(self.a)
        self.a.perception({"1": 1, "2": 2})
        self.a.decisions()  # init the action
        self.a.feedback("rew", 0)  # give some feedback
        reference = {
            "perception": {
                "1": 1,
                "2": 2
            },
            "action": "act",
            "reward": "rew",
            "timestep": 0
        }
        self.assertEqual(reference, self.a.log[0])
        # next step
        self.a.perception({"1": 4, "2": 5})
        self.a.feedback("rew3", 3)
        reference3 = {
            "perception": {
                "1": 4,
                "2": 5
            },
            "action": "act",
            "reward": "rew3",
            "timestep": 3
        }
        self.assertEqual(reference, self.a.log[0])  # same as before
        self.assertEqual(reference3, self.a.log[1])  # new step

    def test_decision(self):
        """
        Tests that the decision is updated correctly
        """
        self.a.decision_fct = DecisionLogicTestingDynamic(self.a)
        n = np.random.randint(1, 20)
        perc = {i: "a" for i in range(n)}
        dec = self.a.decisions(perc)
        self.assertEqual(len(perc), dec)
예제 #9
0
 def __init__(self, *args, **kwargs):
     super(TestBaseAgent, self).__init__(*args, **kwargs)
     self.N = np.random.randint(1, 100)
     self.s = BaseSupervisor(self.N)
     self.a = BaseAgent(0, self.s)