Racso / fzero-apps

Apps I created for the Flipper Zero.
7 stars 2 forks source link

Sokoban: refactor code; implement bigger undo stack #12

Open iliazeus opened 4 months ago

iliazeus commented 4 months ago

This PR grew quite big with refactorings. Best reviewed commit-by commit, or I can split it up into several PRs - whatever you find more convenient.

My ultimate goal with this PR was to re-implement the undo stack implementation. It can now save up to 256 moves while using 250+ times less memory per move. I also moved a bunch of code into separate files, simplified long if-statements, and changed the cell implementation to use bit flags.

Racso commented 4 months ago

Thanks, this is great stuff! One of my priorities was to rework the undo mechanism, but I got busy with life and never got to it. So this helps a lot :)

I'm currently traveling so I'll review and test this in a couple of days.

By the way: the PR is in draft status. Let me know if it's ready for review or if you have pending changes.

iliazeus commented 3 months ago

I'm currently traveling so I'll review and test this in a couple of days.

No problem! I'm on vacation now too, so I also won't reply often.

the PR is in draft status

I mostly put it as a draft because I wanted to test it a little bit more beforehand. The initial implementation had bugs. But I've played this one for a couple of days and everything seems fine, so I'm marking it as ready now.