DaweMolnar / sdl-tetris

Tetris in SDL2
GNU General Public License v3.0
0 stars 0 forks source link

Problem: the program is tightly coupled with SDL #38

Open 1082008 opened 7 years ago

1082008 commented 7 years ago

I see that the name of the project is sdl-tetris but the tight coupling makes is extremely difficult to write tests. And also it would be interesting to make a competition between AIs to see which one of multiple AI algorithms is better in the long term after many games. We are forced to show the output of all games in an SDL window but it makes the competition slow. (Assuming we need only the result of the game to decide which AI is better.)

DaweMolnar commented 7 years ago

Issue #12 is opened because of that problem. If the View interface is completed, I could write a dummy View class to bypass SDL.

DaweMolnar commented 7 years ago

issue #12 did not fix that issue. It still needs sdl for delay, and event polling, without sdl I cannot use sdl delay, but with sdl I cannot use sleep. A separate event poller class is needed, but somehow it have to be forced to use sdl event poller only if the view use sdl too. The competition is manageable in the current state, the only sdl user class is the GameLoop, and without sdl it's just a simple loop, so a loop can be used instead of GameLoop class, that just calls AI controller tick(), and win count is gettable from the Logic class, so the best AI can be chosen.