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

finalize game logic #6

Merged
merged 8 commits into from
Oct 30, 2024
Merged

finalize game logic #6

merged 8 commits into from
Oct 30, 2024

Conversation

rccsousa
Copy link
Collaborator

Why:

A mechanism to handle attempts and emit success / failure messages is necessary in order to smoothen game flow.

How:

By implementing a handleAttempt function that checks if all attempts have been spent and processing new attempts.

Also refactors contract construction.

Comment on lines +127 to +128
emit RemainingAttempts(7 - ATTEMPTS, "Attempts left."); // Clear message
return false; // Incorrect guess
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not replicate this on forge using vm.expectEmit(true, true, true, true) and replicating the message.
Was getting the error that the log was not being emitted, however things were logging correctly. This is the right way to setup emit events, right?

@rccsousa rccsousa changed the title Rs/finalize game logic finalize game logic Oct 30, 2024
@rccsousa rccsousa merged commit e4f3ffd into main Oct 30, 2024
2 checks passed
@rccsousa rccsousa deleted the rs/finalize-game-logic branch October 30, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants