NOTE: The winner of this competition is Jack!!!. No more submissions will be accepted.
Reaper is a game concept developed by the Art of Problem Solving which involves patience and greed. After modifying the game to fit a KOTH style contest (Thanks to @NathanMerrill and @dzaima for your suggestions and improvements), here is the challenge.
The game works as the following: we have a value known as the Reap that multiplies by a given constant every tick. After each tick, each bot has the option of "reaping", which means adding the current value of Reap to one's score, and reducing Reap down to 1.
However, there's a fixed number of ticks that a bot must wait in between "reaps", and a fixed number of points necessary to win the game.
Simple enough? Here are your inputs:
You are to write a function in Python 3 that takes 3 inputs. The first is
self, used for referencing class objects (shown later). The second is the
Reap, the current value of the Reap that you would earn if you were to "reap". The third is
prevReap, a list of the bots that reaped during the previous tick.
Other objects you can access in your function:
self.obj: An object for your use to store information between ticks. self.mult: The multiplier that Reap is multiplied by each tick self.win: The score you need to win self.points: Your current set of points self.waittime: The amount of ticks that you must wait between reaps during the game self.time: The number of ticks since your last reap self.lenBots: The number of bots (including you) in the game. self.getRandom(): Use to produce a random number between 0 and 1.
You MUST not edit any of the contents of these objects, except for
You must output
1 to reap, and anything else (or nothing) to not reap. Note that if you reap when you haven't waited enough ticks, I'll ignore the fact that you have chosen to reap.
The parameters I will be using are
waittime = floor(1.5*x) where
x is the number of bots in the KOTH.
- The game ends when a player (or multiple) reach the winning score.
- When multiple bots ask to reap at once, priority is given to the bots who have waited longer(in case of ties, the bots that have waited the max time all are allowed to reap and gain the points in the Reap)
- Your bot must take no more than 100 ms on average across 5 ticks.
- If you want to import libraries, ask! I'll try to add any libraries that I can run on my desktop version of Python (math is already imported: feel free to use it)
- All of the standard loopholes for KoTHs, such as duplicate bots, 1-up bots, etc, are similarly banned.
- Any bots that use any sort of randomness must use the
getRandomfunction I've provided.
You can find the controller in the TIO link below. To use it, add the name of your function to
BotList as a string, and then add the function to the code. Modify
multiplier to change what the Reap is multiplied by each tick, modify
winning_score to change what score is necessary to end the game, and modify
waittime to change the number of ticks to wait between reaps.
For your convenience, here are some sample (and rather silly) bots. Submitting bots similar to these will not be permitted. However, they demonstrate how the controller works.
def Greedybot(self,Reap, prevReap): return 1 def Randombot(self,Reap, prevReap): if self.obj == None: self.obj= self.obj.append(prevReap) if self.getRandom()>0.5: return 1
For those interested, here is the Controller with the 15 submissions built into it: Try it Online
WOO THEY ARE FINALLY HERE! Check the TIO Link above to see what code I used to generate the final standings. The results are not terribly interesting. Over the 1000 runs I did with different random seeds, the results were
1000 wins - Jack 0 wins - everyone else
Congratulations to the Bounty winner Jack!! (aka @Renzeee)