@PopeyGilbert This is the maths languages' domain, so they're naturally going to have an advantage, as Golfscript, etc. have a more general golfing advantage. I think there are some places where you could choose to draw the line, though. Most leniently, all libraries created before you posted the question are permitted. This would prevent a simple
import answer-type submission. You could say standard (no third-party) libraries only, which permits Mathematica, etc. Or, most strictly, you could permit only primitive drawing functions: draw points and lines, but no graph-plotting functions.
Since you disallow library code that directly relates to the task, and that task is essentially to draw a random network graph, isn't use of native graph-drawing functions also disallowed? This restriction is far from well defined.
Save at least another 12 characters by importing
randint as r,
Image as I,
ImageDraw.Draw as D, which, as part of the imports, doesn't count to your score.
Since the resolution only has to be at least 200x200, you could save a few characters (5, I think) by setting
x=255 and using it to replace the instances of
I've edited the question to provide a way of easily verifying conformance with the spirit of the question, but had to invent thresholds. I think they're reasonable but you may want to tweak them, @BetaDecay.
Provide falsifiable check for mutual intelligibility
Remove brackets around `if` comparison
You'd also be able to substitute
raw_input and save 4 characters in Python 3.
raw_input pulls from
STDIN, but the player history is passed to your program as a command-line argument, which is why you need
sys.argv. For the sake of testing, you could just set it manually with
sys.argv = ["sadist.py", "0", "5 5 5 5"]. Then you should be able to call
player=sys.argv.split(). If importing
sys really is impossible, for testing you could even drop the dot and call the array
sysargv. So long as everything else works and you go back to
sys.argv in your submission, it should be fine.
This was Straight Shooter's original strategy, before Politically Correct Gunman came along. It'll be interesting to see if
S1 does any better than
S2, which is about as far from a winning strategy as it can get. There are a few bots which sweep through the numbers to choose a target, so I suppose it's possible the position of the fixed target might influence the outcome.
@MartinBüttner It isn't. That was my point, and the question has now been edited. Remember that "substitute into" has opposite directionality to "replace with": the original is replaced by its replacement, but a replacement is substituted into the original.
May I suggest substituting "traders" into "Greetings fellow businessmen"? Not everyone here is male, and it's more accurate anyway. Traders needn't have a business of their own.
Italicise other bot names