#NEWLINE# def _get_state( self ) : #NEWLINE# #INDENT# '\n        get the internal game state represented as a numpy array\n        ' #NEWLINE# data = self . game_state . data #NEWLINE# agent_states = self . game_state . data . agentStates #NEWLINE# num_ghosts = ( len ( agent_states ) - 1 ) #NEWLINE# s = np . zeros ( ( ( ( 2 + ( num_ghosts * 3 ) ) + self . num_total_food ) + self . num_total_capsules ) ) #NEWLINE# s [ : 2 ] = agent_states [ 0 ] . configuration . pos #NEWLINE# for i in range ( num_ghosts ) : #NEWLINE# #INDENT# s [ ( 2 + ( i * 3 ) ) : ( ( 2 + ( i * 3 ) ) + 2 ) ] = agent_states [ ( i + 1 ) ] . configuration . pos #NEWLINE# s [ ( ( 2 + ( i * 3 ) ) + 2 ) ] = agent_states [ ( i + 1 ) ] . scaredTimer #NEWLINE# #UNINDENT# i = ( 2 + ( num_ghosts * 3 ) ) #NEWLINE# x = 0 #NEWLINE# y = 0 #NEWLINE# for char in str ( self . layout_copy ) : #NEWLINE# #INDENT# if ( char == '.' ) : #NEWLINE# #INDENT# s [ coord ] = data . food [ x ] [ y ] #NEWLINE# i += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( char == '\n' ) : #NEWLINE# #INDENT# y += 1 #NEWLINE# x = ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( char == 'o' ) : #NEWLINE# #INDENT# coord = ( x , ( self . layout_copy . height - y ) ) #NEWLINE# if ( coord in data . capsules ) : #NEWLINE# #INDENT# s [ i ] = 1.0 #NEWLINE# #UNINDENT# i += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# x += 1 #NEWLINE# #UNINDENT# return s