WLED icon indicating copy to clipboard operation
WLED copied to clipboard

reset usermod TetrisAI back to initial version

Open muebau opened this issue 1 year ago • 4 comments

With this usermod TetrisAI compiles again.

muebau avatar Apr 12 '24 20:04 muebau

fixes https://github.com/Aircoookie/WLED/issues/3888

muebau avatar Apr 12 '24 20:04 muebau

As you are using static variables in your effect function: How does that scale up to playing Tetris on multiple segments?

blazoncek avatar Apr 13 '24 05:04 blazoncek

So this basicially reverts some of the last commits of the usermod (please correct me if I misunderstood)?

Wouldn't it be smarter to resolve the compiler errors in the code, instead of stripping out things until it compiles?

softhack007 avatar Apr 13 '24 19:04 softhack007

OK I need to test if float is good enough for the AI part.

muebau avatar Apr 15 '24 20:04 muebau

@muebau is there any interest in bringing this usermod up to speed and adjust code as requested or do we pull the plug and remove it from WLED? The code that does not compile is of no use and code that does not meet requirements cannot be included.

blazoncek avatar May 22 '24 06:05 blazoncek

@muebau is there any interest in bringing this usermod up to speed and adjust code as requested or do we pull the plug and remove it from WLED? The code that does not compile is of no use and code that does not meet requirements cannot be included.

Well I will try to find time to fix at least the easy parts ( millis() ).

I am still not sure how to target the problem with the state: static TetrisAIGame tetris(cols < 32 ? cols : 32, rows, 1, piecesData, numPieces);

I need an instance of TetrisAIGame for each segment, and it needs to be permanent. Every time the size of the segment (or other parameters) changes, I need to destroy the current instance and create a new one to be able to 'work' on the internal game grid.

I would appreciate suggestions from developers with more insight into WLED and C++.

muebau avatar May 22 '24 12:05 muebau

I need to destroy the current instance and create a new one to be able to 'work' on the internal game grid

Do you really need to destroy it? It is just the two variables that change X and Y. The other approach might be to just store relevant data in allocateData() buffer and use it as a POD.

Some other effects tackle this so take a look at other 2D effects.

blazoncek avatar May 22 '24 18:05 blazoncek

I think this should fix the issues. What do you think?

muebau avatar May 24 '24 07:05 muebau

Nice update... Tested on my 32x32 Matrix with 4 segments PXL_20240525_200225594~2

robertvb83 avatar May 25 '24 20:05 robertvb83

Love to see it is working as it does here. 😂

muebau avatar May 25 '24 20:05 muebau

BTW is this a WS2812 4X16X16 setup or something else?

muebau avatar May 25 '24 21:05 muebau

BTW is this a WS2812 4X16X16 setup or something else?

Yes exactly this, with an added 3d printed grid and diffuser foil

robertvb83 avatar May 25 '24 21:05 robertvb83