features/battle/battle-ai/modules/custom_RL/gym-pokemon/gym_pokemon/envs/pokemon_env.py
def step(self, action):
		#open the json file to write action into file
		dataFile = open(self.rlDataJson, "w")
		#because dictionary is immutable, instead make new dictionary
		self.state = {
			'battleDecisions': self.state["battleDecisions"],
			'battleData': self.state["battleData"],
			'actionReturned': True,
			'pythonStarted': self.state["pythonStarted"],
			'action': action
		}
		#dump the dictionary into the opened file
		json.dump(self.state, dataFile)
		dataFile.close()
		#wait for 'actionReturned' to be false again
		time.sleep(3)
		while(True):
			#need to wait sometime here to prevent overload
			#if actionReturned is back to false, exit the loop
			dataFile = open(self.rlDataJson, "r")
			self.state = json.loads(dataFile.read())
			dataFile.close()
			if(not self.state["actionReturned"]):
				break
		return [self.state, self.getReward(), False, None]

		"""
        The agent takes a step in the environment.

        Parameters
        ----------
        action : int

        Returns
        -------
        ob, reward, episode_over, info : tuple
            ob (object) :
                an environment-specific object representing your observation of
                the environment.
            reward (float) :
                amount of reward achieved by the previous action. The scale
                varies between environments, but the goal is always to increase
                your total reward.
            episode_over (bool) :
                whether it's time to reset the environment again. Most (but not
                all) tasks are divided up into well-defined episodes, and done
                being True indicates the episode has terminated. (For example,
                perhaps the pole tipped too far, or you lost your last life.)
            info (dict) :
                 diagnostic information useful for debugging. It can sometimes
                 be useful for learning (for example, it might contain the raw
                 probabilities behind the environment's last state change).
                 However, official evaluations of your agent are not allowed to
                 use this for learning.
        """

        The agent takes a step in the environment.

        Parameters
        ----------
        action : int

        Returns
        -------
        ob, reward, episode_over, info : tuple
            ob (object) :
                an environment-specific object representing your observation of
                the environment.
            reward (float) :
                amount of reward achieved by the previous action. The scale
                varies between environments, but the goal is always to increase
                your total reward.
            episode_over (bool) :
                whether it's time to reset the environment again. Most (but not
                all) tasks are divided up into well-defined episodes, and done
                being True indicates the episode has terminated. (For example,
                perhaps the pole tipped too far, or you lost your last life.)
            info (dict) :
                 diagnostic information useful for debugging. It can sometimes
                 be useful for learning (for example, it might contain the raw
                 probabilities behind the environment's last state change).
                 However, official evaluations of your agent are not allowed to
                 use this for learning.
        
The agent takes a step in the environment.
Parameters

action : int

Returns

ob, reward, episode_over, info : tuple
ob (object) :
an environment-specific object representing your observation of
the environment.
reward (float) :
amount of reward achieved by the previous action. The scale
varies between environments, but the goal is always to increase
your total reward.
episode_over (bool) :
whether it's time to reset the environment again. Most (but not
all) tasks are divided up into well-defined episodes, and done
being True indicates the episode has terminated. (For example,
perhaps the pole tipped too far, or you lost your last life.)
info (dict) :
diagnostic information useful for debugging. It can sometimes
be useful for learning (for example, it might contain the raw
probabilities behind the environment's last state change).
However, official evaluations of your agent are not allowed to
use this for learning.
The agent takes a step in the environment . Parameters action : int Returns ob reward episode_over info : tuple ob ( object ) : an environment - specific object representing your observation of the environment . reward ( float ) : amount of reward achieved by the previous action . The scale varies between environments but the goal is always to increase your total reward . episode_over ( bool ) : whether it ' s time to reset the environment again . Most ( but not all ) tasks are divided up into well - defined episodes and done being True indicates the episode has terminated . ( For example perhaps the pole tipped too far or you lost your last life . ) info ( dict ) : diagnostic information useful for debugging . It can sometimes be useful for learning ( for example it might contain the raw probabilities behind the environment ' s last state change ) . However official evaluations of your agent are not allowed to use this for learning .
def step(self, action):
		dataFile = open(self.rlDataJson, "w")
		self.state = {
			'battleDecisions': self.state["battleDecisions"],
			'battleData': self.state["battleData"],
			'actionReturned': True,
			'pythonStarted': self.state["pythonStarted"],
			'action': action
		}
		json.dump(self.state, dataFile)
		dataFile.close()
		time.sleep(3)
		while(True):
			dataFile = open(self.rlDataJson, "r")
			self.state = json.loads(dataFile.read())
			dataFile.close()
			if(not self.state["actionReturned"]):
				break
		return [self.state, self.getReward(), False, None]
def step ( self , action ) : dataFile = open ( self . rlDataJson , "w" ) self . state = { 'battleDecisions' : self . state [ "battleDecisions" ] , 'battleData' : self . state [ "battleData" ] , 'actionReturned' : True , 'pythonStarted' : self . state [ "pythonStarted" ] , 'action' : action } json . dump ( self . state , dataFile ) dataFile . close ( ) time . sleep ( 3 ) while ( True ) : dataFile = open ( self . rlDataJson , "r" ) self . state = json . loads ( dataFile . read ( ) ) dataFile . close ( ) if ( not self . state [ "actionReturned" ] ) : break return [ self . state , self . getReward ( ) , False , None ]
The agent takes a step in the environment.
The agent takes a step in the environment .
#open the json file to write action into file #because dictionary is immutable, instead make new dictionary #dump the dictionary into the opened file #wait for 'actionReturned' to be false again #need to wait sometime here to prevent overload #if actionReturned is back to false, exit the loop """
        The agent takes a step in the environment.

        Parameters
        ----------
        action : int

        Returns
        -------
        ob, reward, episode_over, info : tuple
            ob (object) :
                an environment-specific object representing your observation of
                the environment.
            reward (float) :
                amount of reward achieved by the previous action. The scale
                varies between environments, but the goal is always to increase
                your total reward.
            episode_over (bool) :
                whether it's time to reset the environment again. Most (but not
                all) tasks are divided up into well-defined episodes, and done
                being True indicates the episode has terminated. (For example,
                perhaps the pole tipped too far, or you lost your last life.)
            info (dict) :
                 diagnostic information useful for debugging. It can sometimes
                 be useful for learning (for example, it might contain the raw
                 probabilities behind the environment's last state change).
                 However, official evaluations of your agent are not allowed to
                 use this for learning.
        """
self
action