Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rare Bug in Aces Up Example #340

Open
hendursaga opened this issue Oct 10, 2023 · 1 comment
Open

Rare Bug in Aces Up Example #340

hendursaga opened this issue Oct 10, 2023 · 1 comment

Comments

@hendursaga
Copy link

First off, thanks for GBForth and for the excellent example game.

I found a bug in (presumably) all-unique-tops? where it prematurely quits the game when there are no more cards to deal with, but there's at least one empty pile. See attachment below.

gbforth-aces-up-bug

I had some trouble reproducing this issue, as I couldn't take a screenshot in time before the "explosions" happened and the score was displayed, so I commented that out.

Out of curiosity, suppose I had a dump of the RAM after "winning" prematurely, but before pressing any key, so that reset-game would have not been called yet. What could I have done to look at what the piles / stacks were?

@tkers
Copy link
Member

tkers commented Oct 16, 2023

Thanks for having a look at our project and taking the time to submit this bug!

That does sound hard to reproduce, yes 😄 But I can indeed imagine that all-unique-tops does not consider the case of "empty pile" correctly and basically considers it a 5th suit instead. An extra check for empty spots would probably be in place to determine the gameover state.

If you have the RAM contents, you could check at what address pile-1 is located by looking it up in the aces-up.sym file. You'd need to look for the one marked with (BODY) specifically, as that's the part that holds the data (the other one is the word itself, located in the ROM, that fetches the value). From there you'll find 1 cell (2 bytes) containing the size of the pile, and up to 13 cells (26 bytes) of data representing the cards on that stack, which you can decode with card>suit and card>rank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants