Take 6!
A good card game is a wonderful thing. I got me a nice fresh set of Take 6! Too bad though, I have no-one to play with. And so I turn to you!
The Game
The game is played with a set of 104 cards, numbered 1 to 104 inclusively. Each card has a number of 'cows' attached. Here's a quick Python function to calculate the number of cows:
def cows(card):
out = 1
if(card % 5) == 0:
out += 1
if(card % 10) == 0:
out += 1
if(card % 11) == 0:
out += 4
if(card % 5) == 0: # C-c-c-combo
out += 1
return out
Therefore, there is a total of
1 card with 7 cows (number 55)
8 cards with 5 cows (the other multiples of 11: 11, 22, 33,
44, 66, 77, 88, 99)
10 cards with 3 cows (multiples of ten: 10, 20, 30, 40, 50,
60, 70, 80, 90, 100)
9 cards with 2 cows (other multiples of five: 5, 15, 25, 35, 45, 65, 75, 85, 95)
76 cards with 1 cow (all other cards)
The game is played by up to 10 players.
Each player is given 10 cards. 4 cards are placed on the table as the starts of 'rows'. Then 10 turns of play take place. Then, results are calculated.
A turn
Each player selects one of their remaining cards. At the same time, they reveal their selected cards.
Going in the order of lowest card number, the player whose card it is must place it into a row according to rules:
If there is a row with the top card of a lower number than the player's and no such row with a lower number exists, their card must be placed at the end of the row. If their card is the sixth in a row, they take the first 5 cards and put them on their result pile, leaving theirs as the new start.
If no such row exists, they must pick one of the rows, take all the cards there to their result pile, and leave their card as the new start.
Examples:
row tops: 10 20 30 40
played: 25
must be placed on the row with a 20, creating the configuration 10 25 30 40 with a possible cow gain
row tops: 10 20 30 40
played: 9
pick any row, creating for example 10 20 9 40, but guaranteed to gain cows
Counting
The sum of cow values of the cards in a player's result pile is their score. The lower the score the better.
Scores may be added up over several games, creating an overall score for a match.
Bots
Bots will be standalone programs. Everything belonging to a bot will be placed in a single directory, the name of the directory will be used as the name of the bot. A launch script named launch
(may be the entire bot) must be provided. If necessary, a compilation script named build
may be provided. Both scripts shall be placed directly in the bot's directory and should use shebangs to specify how they are to be run.
Bots shall not interfere with other bots, the controller, or the git repositories used.
The bots will have the option of storing extra information in files in their own directory. It will be wiped when a fresh series is being run (such as after adding a new bot).
An override input format may be provided. I intend to use StringTemplate for this, I'll write up some details when working on the controller. The default format will have all messages newline-terminated.
Once launched, the bot will be first given their cards, as a list of card numbers, where the numbers may or may not be ordered.
The default format will be
cards 0 1 2 3 4 5 6 7 8 9
No response is expected.
For each round, the bot will be prompted with the current state of the grid, that is the number of cards in each row, the sum of cows in each row and the top number card in the row.
The default format will be
count 1 2 3 4
cows 5 6 7 8
top 11 20 22 35
The bot shall answer with the number of one of its remaining cards.
The list of all the cards used by all bots in the round will be given to each bot. Not that this includes the bot's own card. The order of bots in this message will be consistent within a game.
The default format will be
used 0 1 2 3 4 5 6 7 8 9
No response is expected.
If the placement rule 2. has to be invoked, the bot will receive a message containing the board state at the time when it needs to pick a row
The default format will be
pickrow
count 1 2 3 4
cows 5 6 7 8
top 11 20 22 35
The bot shall respond with the number of the row it wishes to take. The rows will be 0-indexed for this.
If the bot's move results in a gain of result cows, it will be informed of which cards and how many cows it has gained (note that the lower the number the better).
The default format will be
cardgain 1 2 3 4 5
cowgain 6
No response is expected.
At the end, all bots will be shown their score as well as all the scores of others, in the order consistent with the used cards message.
The default format will be
score 30
others 0 1 2 3 4 5 6 7 8
No response is expected.
If the bot makes an invalid move, it will be delivered a special message informing it of such. From that point the bot's current game is over. It gets 100 points of penalty.
The default format will be
invalid
A timely shutdown is expected.
The bot may of course try to save information to its private file at any time, including at the end.
After the final message, the bot shall terminate in a timely manner.
Scoring will be added up over many games, number depends on how fast the games end up running, but at least 100 sounds reasonable to me.
Bots will be placed in a separate github repository TODO for easy setup and reseting. Bots that need a compilation script but don't have one will be given one.
Controler
Work has started at https://github.com/MrRedstoner/Take6KOTH
The controller will be designed to run in Java 1.8+, using the Process API to launch bots.
Notes:
While the number of bots is too low, it will be padded to 10 by using multiples of primitive bots. The tournament style once 11+ submissions exist is for now playing all subsets of size 10.
I intend to write up at least a few primitive bots, to get the games going. Something like using cards in the order they were given, or randomly. These will also demonstrate the custom input functionality. Maybe even one that uses external input, to let me play for fun!
Limits for execution time, storage of data etc. are not given at this time. If bots start to behave excessively limits may be added.
Sandbox notes:
Any better idea for tournament?
Should bots be given the names of their competitors as well? Currently leaning towards yes.
Planned tags: king-of-the-hill