Define observation space / gym.openai

Python auf Einplatinencomputer wie Raspberry Pi, Banana Pi / Python für Micro-Controller
Antworten
Lena2309
User
Beiträge: 1
Registriert: Mittwoch 20. November 2019, 08:24

We are trying to make a Tetris AI on a raspberry pi which is connected to a board with WS2812b LEDs. We defined the action_space and observation_space like this:

Code: Alles auswählen

self.action_space = spaces.Discrete(6)
self.observation_space = spaces.Discrete(width * height * block_number * block_degree * stored_block)
We have 6 actions: move left, move right, turn left, turn right, hold block, wait.

Our board has a width of 8 pixels and a height of 16 pixels.

block_number is the amount of different blocks, in our case we have 7 different blocks.

block_degree is the number of degree when we turn the block right or left (0, 90, 180, 270).

stored_block can be used to save a block and use it later. We have 8 different options (block 1-7 or none)

When we use this

Code: Alles auswählen

(self.observation_space = spaces.Discrete(8*16*7*4*8))
or any number greater than 2 we get this errror:

Code: Alles auswählen

IndexError: too many indices for array
If our

Code: Alles auswählen

observation_space 
is 2 or 1 we get this Error:

Code: Alles auswählen

IndexError: index 1 is out of bounds for axis 0 with size 1
Does anyone know the problem and how can we find out the right observation_space?

Thank you in advance.
Antworten