Every player has a number. Can yours be the farthest from them all?
Requirements
Write a Java, Python 2, or Ruby function named choose()
that accepts three arguments:
- an integer - the number of rounds already completed
- an integer - the number of players
- an array of strings - the results of each previous round
- each string is a space-separated list of integers, sorted from lowest to highest
For example, choose(2, 4, ["4 93 93 174", "1 84 234 555"])
means:
- there were already two rounds (this is the third round)
- there are a total of four players
- in the first round, the numbers chosen were 4, 93, 93, 174
- in the second round, the numbers chosen were 1, 84, 234, 555
You must return a whole number from 1 to 999 (inclusive).
For each other player, your score is the square root of the distance between your number and theirs. Your score for the round is the total of all of these scores.
100 rounds will be played. The highest total score wins!
Rules
- Your code may not use any I/O, including console, files, network, etc.
- You may not interfere with the control program or any other players.
- Programs which look like they violate the above rules will be excluded.
- Each call of a function should take under five seconds on my computer (Intel Core i5 2450M with 8GB of RAM).
- If a program throws an exception or returns an invalid value, it will be treated as if it returned 1.
- Each user may submit at most one program.
Miscellaneous
- The control program is on GitHub.
- There are three built-in players. They can be found in this answerthis answer.
- The winner will be chosen on January 28.
Leaderboard
The winner is ConservatorConservator.
Honorable mention to GustavGustav, the highest scoring player with a non-constant strategy.
- Conservator - 36226
- High - 36115
- FloorHugger - 35880
- NumberOne - 35791
- Overestimator - 35791
- Gustav - 35484
- Historian - 35201
- Sampler - 34960
- Incrementer - 34351
- JumpRightIn - 34074
- Vickrey - 34020
- Teenager - 33907
- Randu - 33891
- Weightlifter - 33682
- Middleman - 33647
- BounceInwards - 33529
- NastyMathematician - 33292
- Jumper - 33244
- Copycat - 33049
The full results can be found here. (I recommend disabling text wrapping.)