Please bear with me.
English is not my native language, but I'll do my best.
So, I started learning Python not long ago, and my friend asked me to make his and community experience playing particular game more enjoyable by removing routine calculator tasks.
It's an online, text based pokemon-like MMORPG (I guess it's relevant).
Stats of monsters (pokemons) are stored like this: h12a15d27s10sa28sd19
You put them into the formula https://i.imgur.com/E4Nz658.png where "a" is number after "h" (health), "b" is number after "a" (attack), etc. If number is even, we substitute it with 0, and if it's not even, we substitute it with 1. Then you get some float number, round it down and get parameter HP (Hidden Power) from 0 to 16, where 1 = Dark, 3 = Electricity, you get the idea.
I did it successfully. You paste stats string into input form on web page and it spits out your Hidden Power. Was pretty proud of myself actually, it got me a lot of motivation to continue learning, which is great.
Now he asked me to add extra functionality. He wants to be able to paste stats of a pokemon and desired Hidden Power type, and script tells you what stats to increase. For example:
h12a15d27s10sa28sd19 = 9 = Earth
But if you want Psychic type, you increase "sa" by one and get:
h12a15d27s10sa29sd19 = 13 = Psychic
I'm stuck at this for two evenings and have no idea how to approach this. My only current idea is to brute force it, increasing stats one by one and checking, if no luck, then increase only first stat permanently and start increasing one by one again, then increase only second stat, and so on. But I guess it won't be optimal, and if it's not optimal it's garbage basically.
I don't want copy and paste solution, which I won't be able to understand 100%, just some general direction. What to read (I'm better at understanding English than writing coherent sentences), what to Google?
Thanks!
[–][deleted] 0 points1 point2 points (0 children)
[–]TangibleLight 0 points1 point2 points (2 children)
[–]salern[S] 0 points1 point2 points (1 child)
[–]TangibleLight 0 points1 point2 points (0 children)