13
2
Basic rules (different from mine)
Story
It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 trillion rep on every SE site... Yeah scary I know
Chopsticks is a hand game that has been solved. So to get around this I have created it mutated. I increased the amount of fingers.
Rules of the game
The way this is played
Everyone starts with 2 hands. Each hand has 1001 fingers. Every hand starts with 1 (one) finger up on each hand. During your turn you can "hit" the other players hand. To hit you choose 1 of your hands to hit with and 1 of their hands to hit. The hand that was hit now has the amount of fingers that was their at first AND the amount of fingers that you had on the hand you hit with.
EX
P1: 1,1
P2: 1,1
. P1[0]
hits P2[1]
. Now fingers are P1:1,1
P2:1,2
. Now P2[1]
hits p1[0]
. The fingers are now P1: 3,1
P2 1,2
.
If one hand gets to 1001 fingers up or more then that hand is out. Then player who got a hand out (for their turn) can "split". Splitting is when you take the hand that is in and halve the amount of fingers (round up) and give those fingers to the other hand getting it back in.
EX
P1: 1000,2
P2 7,7
. P2[0]
hitsP1[0]
. Score is P1: 0,2
P2 1,1
. P1[1]
splits for his turn and the score is P1: 1,1
and P2 7,7
.
The game ends when one player has both hands out. Points are scored by the amount of fingers the winner has. More points = better. The loser gains no points.
There are other rules that are used but these are the ones used here.
Everybody plays everybody (round robin)
Endgame
Total your points up from every round you win. Then average everybody's points up. Divide your total by the average points and get your final score. Most points win.
Actual rules
Please do not try to solve the game. I actually have to be able to run it :P
Make sure the bot can run fast. With the length of rounds judging this will take a while
All libraries needed in your program must be in the default python library. Also list the ones you need imported. Imports will just be the basic import (for math I do: import math
)
Answers must work in Python 3.x
Handler
Your bot will be its own Python 3 file with a play
function.
play
will be passed two lists of two numbers each. This number indicates how many fingers are up on each hand. The first list is your own hand.
If you choose to hit the other player's hand, then return a list of two bits. The first bit is the index of the hand you are using to hit (0
for the first, 1
for the last), and the second bit is the index of the hand you are hitting on the opponent.
If you choose to split, return any other truthy value.
Tada!
The controller can be found here. Save each bot in its own file and list each bot's filename (without .py
) in botnames
.
Final note:
You and the other bot will take turns going first. If the game does not terminate in 100,000 (one hundred thousand) rounds, the game will be terminated and neither bot wins.
The controller is not protected against moves taking forever, but unnecessary overhead will be strongly frowned upon.
Sandbox – Christopher – 2017-07-19T15:50:40.383
Could "Standard KOTH rules" be a link? And maybe "Standard loopholes" too. – trichoplax – 2017-07-19T15:52:01.837
My handler is very simple, your bot must do it's logic then adjust the the finger scores as needed, remember!
What, so we're the ones doing the computations for the KoTH? – HyperNeutrino – 2017-07-19T15:53:19.217@HyperNeutrino opps fixing. – Christopher – 2017-07-19T15:54:29.783
@Christopher Where is
bot1split
defined? Your controller isn't going to work. – HyperNeutrino – 2017-07-19T16:20:01.673@HyperNeutrino sorry copy paste error – Christopher – 2017-07-19T16:21:04.187
This makes it impossible to split. Python is pass-by-reference, but if you redefine a function parameter, it will just change the local reference. Your controller still won't work. – HyperNeutrino – 2017-07-19T16:22:23.297
@HyperNeutrino screw python. How do I fix that? – Christopher – 2017-07-19T16:22:43.557
@Christopher Hold on, I'll rewrite the controller in a bit. I don't like the hardcoding of the function names either, so I'll send teh codez in a bit. – HyperNeutrino – 2017-07-19T16:23:33.340
@HyperNeutrino I owe you one :P ty so much. I suck at writing this codez – Christopher – 2017-07-19T16:29:39.407
@Arnauld thanks – Christopher – 2017-07-19T17:35:18.187
4Dennis has more rep than Martin now. Oh my god, where did these extra 996 fingers come from?! – caird coinheringaahing – 2017-07-19T23:16:47.710
@cairdcoinheringaahing we have no idea. I am so sorry. – Christopher – 2017-07-20T02:10:28.923
The post says "Points are scored by the amount of fingers the winner has," but the controller you link to only records win/losses when I run it. Is this intended or did I do something wrong here? – Magenta – 2017-07-23T13:47:53.370
@mag hmm looking into that. I actually have a few things to do with it first. But I will fix it – Christopher – 2017-07-23T15:12:45.283
I would VTC this as unclear because of the controller issues, but apparently that's impossible if there's a bounty running. So count this as a virtual VTC from me. – Mego – 2017-07-25T22:51:54.870
@Mego controller issues? Also Virtual VTO – Christopher – 2017-07-25T23:27:02.450
@Christopher As Magenta mentioned, the scoring in the controller doesn't match the scoring in the description. – Mego – 2017-07-25T23:28:03.870
@Mego OH, I have a version for scores. I didn't provide it since I did not think people needed to know. I will update – Christopher – 2017-07-25T23:38:01.430
@Christopher You didn't think people would need a controller that matches the spec? – Mego – 2017-07-26T00:54:25.067
@Mego I didn't think – Christopher – 2017-07-26T16:23:33.913