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

Is there any error with game4.sol ? #1

Open
A-s-h-i-s-h-Biswas opened this issue Mar 27, 2023 · 3 comments
Open

Is there any error with game4.sol ? #1

A-s-h-i-s-h-Biswas opened this issue Mar 27, 2023 · 3 comments

Comments

@A-s-h-i-s-h-Biswas
Copy link

Both x and y are of type uint8
and have to make a sum of type uint8 to 10
As x is of uint8 we can't use ("-") negative sign
How will it be possible ?

@acristoni
Copy link

I changed types in the contract, only this time rsrs...

@yandhii
Copy link

yandhii commented Jun 29, 2023

You can pass x=56 as the parameter to win(). Note that the original contract use unchecked, which means you can use the overflow feature of it. For uint8, (x+210) % 256 = 10 => x = 56。

@Thomas-Heniart
Copy link

Thank you @yandhii, your explanation is pretty clear!

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

No branches or pull requests

4 participants