leap0x7b / SocialCreditSimulator

A command line simulator game taking place in mainland China
1 stars 1 forks source link

[bug] Saying you play video games between 10 hours and 39 hours will still give you social points #1

Open setapdede opened 3 years ago

Ritter128 commented 3 years ago

Okay so I know what the problem is. The thing about the numbers 10 and 39 is that they all contain 1, 2, 3 which are the goods numbers of playing video games. The code is only looking for those characters, it doesn't care if there is another number attached to it. So, how do we fix this? A simple fix is to look for not only the number, but the space after it, because that means it isn't attached to another number. This does mean the user can still say something like "play games 3 8 hours", but let's be honest, we only care about the first number, so this isn't something to get a headache over. My code: elif "play" in inp: if "video" in inp \ or "games" in inp: if "hours" in inp: if "3 " in inp \ or "2 " in inp \ or "1 " in inp: increaseSocialCredit(120) else: decreaseSocialCredit(1200) (I am new and I don't know how to format)

Ritter128 commented 3 years ago

Also I don't know how to commit to this project yet, but just add a space after the nono numbers and it should work.

Ritter128 commented 3 years ago

And by nono numbers I mean like this: "3 " "2 " "1 "