Logic Error with Paper/Rock/Scissor Game

Hi, I am writing a program with Paper/Rock/Scissor game, and the rule of the game is:

- when Paper battles Rock, the strength is doubled
- when Paper battles Scissor, the strength is halved

- when Rock battles Paper, the strength is halved
- when Rock battles Scissor, the strength is doubled

- when Scissor battles Paper, the strength is doubled
- when Scissor battles Rock, the strength is halved



However, I still stuck with the logic error. For example, if the strength of the rock is 70, and the strength of the paper is 10, the paper will still best the rock regardless the half strength of the rock is 35, which is still stronger than the strength of the paper. What is the exact problem here?
Last edited on
Do you mean
w.modified = w.strength * 2;
and many similar. Whose strength are you looking at?

Not related, but what do you think returning -1 does when the return type is bool? This will lead to some anomalously asymmetric battles.

There is an awful lot of code repetition here.
Thank you for your advice, I am planning to rewrite the code.
Topic archived. No new replies allowed.