DealORound / Deal-O-Round

Flutter port of the Deal-O-Round board card game
MIT License
2 stars 0 forks source link

After several (many?) levels the newly dealt cards may come in tinted as selected #13

Closed MrCsabaToth closed 4 years ago

MrCsabaToth commented 4 years ago

That selection tint is fake because if I select a hand it is still removed, while the fake tinted ones stay. But once this error kicks in the game stays like that and all newly dealt cards became like that. Screenshot_20200902-085516

MrCsabaToth commented 4 years ago

I'm debugging this intensively. Apparently this can happen if the decks in the shoe rotated over completely. Besides the selected cards appearing also empty slots start to appear on the board after a while. The empty slots would be Invalid cards theoretically (a safety measure causes the draw of an empty slot), but in this state the board actually has legitimate cards in the place of the empty slots. So far all my tests and debug couldn't reveal an error on my end.

Partial workaround would be to increase the shoe size to a very large number. Given this bug is set off when the shoe is rotated around. Instead of that I'm developing now an endless shoe, which adds new decks on demand instead of rotatng around and recycling a constant finite amount of decks.

MrCsabaToth commented 4 years ago

The bottomless shoe solves the bug. It's a question now if that can consume up too much resources, but doe to the nature of the logarithmic level progression probably players cannot reach a point when the number of dealt decks would cause a real performance issue.

In case this issue will come back in any form, one more change can be made: the y in the listKeys[x].currentState.insertItem(y) stays in the range of [0...maxY - 1] (maxY 4 or 5). If the recurrence of numbers may inflict any bug inside the AnimatedList state internals we can make y a monotonic increasing value: it can index a linear range which can be translated back to deck index and card index within that. Or we can employ an additional dealt card list but probably we can just transform the linear range by the shoe.