1

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:

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 (self.observation_space = spaces.Discrete(8*16*7*4*8)) or any number greater than 2 we get this errror:

IndexError: too many indices for array

If our observation_space 2 or 1 we get this Error:

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.

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
J.Doe
  • 9
  • 2

0 Answers0