- 1

Exploring the possible uses for Recursion

Could this be used to create a bot on a game? Or even worst, a hacker program that removes money on a program like on the show "StartUp" lol. For example, int bankacount(int savings) { if (savings == 1) {return 1; } else { return n - bankacount (savings - 10); } } This would take all of the money or "Gen Coin" in $10 increments until it's only a dollar left. lol just a concept. Watch out Araknet! Or if used for a bot on a game, the bot would keep attacking the enemy until their health reached one. (assuming that the function is reading health as the variable number). I guess health could be programmed to where if (health == 1 ) {death = true} . I'm a beginner, but I had a few possible ideas for application. Although, I think this may be easier with a for loop or something. To be clear, I would not try to hack anyone's bank account, just an educational concept. lol Please don't ban me!

3rd Jun 2021, 3:49 PM
TeAiris Majors
TeAiris Majors - avatar
2 Réponses
+ 1
or when you complete the whole operation. you wanna make the program to ask that again without using any loop, or when the user types invaild input, you would ask the question again.
3rd Jun 2021, 4:17 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Oh cool. So you could print to the screen. "Invalid input. Try again." Or even cycle through responses until the correct input is given like hints? That would be useful! Thanks for your input !
3rd Jun 2021, 5:40 PM
TeAiris Majors
TeAiris Majors - avatar