Lets play a game of Meta tic-tac-toe!
This is a king-of-the-hill tournament of Meta tic-tac-toe. The rules of Meta tic-tac-toe are as follows:
All of the regular rules of tic-tac-toe apply.
There are nine boards arranged to make one master board. Like so:
0|1|2 || 0|1|2 || 0|1|2 ----- || ----- || ----- 3|4|5 || 3|4|5 || 3|4|5 ----- || ----- || ----- 6|7|8 || 6|7|8 || 6|7|8 ======================== 0|1|2 || 0|1|2 || 0|1|2 ----- || ----- || ----- 3|4|5 || 3|4|5 || 3|4|5 ----- || ----- || ----- 6|7|8 || 6|7|8 || 6|7|8 ======================== 0|1|2 || 0|1|2 || 0|1|2 ----- || ----- || ----- 3|4|5 || 3|4|5 || 3|4|5 ----- || ----- || ----- 6|7|8 || 6|7|8 || 6|7|8
board 0 refers to the top left board, board 1 refers to the top middle board... like this
0|1|2 ----- 3|4|5 ----- 6|7|8
If I say board 3, tile 4, that means the center tile of the board on the middle left.
You are only allowed to move in one of the smaller boards.
If you win one of the smaller boards, that entire board counts as your tile.
If one of the boards becomes filled before either bot has won it, it counts as nobodies tile.
Whoever wins the master board wins!
However, there is an important twist. Let's say I go in board 7, tile 2. That means on your turn, you can only go in board 2. Then let's say you go in board 2, tile 5. Now on my turn, I can only go in board 5. Let's say that board 1 is full. (There are no more spots left, or one of us has already won board 1) Now if I go in board 5, tile 1, you can go in any of the boards you want.
These rules can be regarded as:
- You must play in the board corresponding to the position played by the previous player.
- If X plays in board 2, tile 5; O must play in board 5
- If the target board is full (a tie) or already has a victor, the next move is unconstrained.
- A board with a winner may not be played into, even on an unconstrained move.
If this is a little bit confusing, you can try it online here. (make sure to switch from "first tile wins" to "3 tiles in a row")
Now here are the rules of the challenge.
You must write a bot that plays this game.
Bot 1 is Xs, and it gets to go first. It will be called with these command line arguments (without the stuff in parentheses):
X (whose turn) --------- (board 0) --------- (board 1) --------- (board 2) --------- (board 3) --------- (board 4) --------- (board 5) --------- (board 6) --------- (board 7) --------- (board 8) --------- (master board) xx (last move)
The first character represents who the bot is. In this case, bot 1 plays as X. The next 9 lines refers to the 9 boards. The 11th line refers to the master board. The "xx" is the last move. Now, bot1 must print two numbers between 0 and 8. Number 1 is the board your bot is moving in, and number 2 is the tile in said board. The controller will keep track of this move. Let's say bot 1 prints 38. Now the board will look like this:
| | || | | || | | ----- || ----- || ----- | | || | | || | | ----- || ----- || ----- | | || | | || | | ========================== | | || | | || | | ----- || ----- || ----- | | || | | || | | ----- || ----- || ----- | |X || | | || | | ========================== | | || | | || | | ----- || ----- || ----- | | || | | || | | ----- || ----- || ----- | | || | | || | |
and bot2 will be called with these arguments:
O --------- --------- --------- --------X --------- --------- --------- --------- --------- --------- 38
Now bot 2 must move in board 8 (because bot1 placed an x in tile 3). Let's say bot2 prints 84. Now the board looks like this.
| | || | | || | | ----- || ----- || ----- | | || | | || | | ----- || ----- || ----- | | || | | || | | ========================== | | || | | || | | ----- || ----- || ----- | | || | | || | | ----- || ----- || ----- | |X || | | || | | ========================== | | || | | || | | ----- || ----- || ----- | | || | | || |O| ----- || ----- || ----- | | || | | || | |
now bot1 is going to be called with these arguments:
X --------- --------- --------- --------X --------- --------- --------- --------- ----0---- --------- 84
Now bot1 must move in board 4. However, bot1 is a naughty little bot, and decides to move in board 3. It prints '30'. The board does not change at all. The master bot keeps track of this. Now bot2 will be called with these arguments:
O --------- --------- --------- --------X --------- --------- --------- --------- ----0---- --------- xx
Now bot 2 can go anywhere it wants (except for 38 and 84, of course). This continues until somebody wins 3 of the master boards in a row. Then, there is a second matchup where bot2 is X and gets to go first.
This repeats until every single bot has played every other bot.
Scoring
The scoring works like this:
The winner of a each match gets 100 + number of open spots
points. That way, it is more valuable if your bot wins quickly. Every time your bot makes an invalid move, it loses 1 point. If after 250 rounds, neither bot has won, each bot loses 10 points, and we go on to the next round.
Everything will be put into a directory that contains
The controller bot. This is a C++ program that I have written. You can look at the controller bot source code here. Please let me know if you see something that isn't right with the controller.
A text file named
instructions.txt
This file will look something like this:[Total number of bots that are competing] [bot1Name] [bot1 command to run] [bot2Name] [bot2 command to run] ...
A folder for each bot. This folder will hold your program (Whether it's a script or a binary) and ONE text file named
data.txt
that your bot can read and write whatever it wants to.
Technical specifications and rule clarifications
Any bot that attempts to read/write something from anywhere not inside of it's folder will be kicked from the game.
Your program must be able to run on a macbook running Yosemite. Currently supported languages are python (2.7.9 and 3.4.2), C/C++, objective-C, perl, ruby, bash, PHP, Java, C#, javascript and Haskell. There are a lot more, but these are just the ones I can think of right now. I will add more as time goes on. If you want to compete in a specific language, message me or comment, and I'll add it to the list if possible.
If a board is won, but there is still space, you still cannot move into one of the open spots.
Note that the working directory of your submission will be the directory that contains the controller and all the other bots, NOT the directory that contains your bot.
Please post along with your controller bot code the correct command to compile (if applicable) and to run your bot. Most of this will be done from the OS X terminal, which is fairly similar to a linux terminal.
Bots must complete in under a second. Unfortunately, I am not quite competent enough to add a timer to the controller bot. However, I will manually time the bots.
Results!
Well, I was right. I forgot to make the controller bot check to see if the masterBoard is full. If the masterBoard is full, then EVERY move is invalid, but it continues to call the bots, which is probably why there were so many invalid moves. I have it fixed now. Here are the official results with the most current version of all of the bots.
Bot 1, goodRandBot, has 1 wins and made 0 illegal moves, for a total of 133 points.
Bot 2, naiveBot, has 3 wins and made 48 illegal moves, for a total of 361 points.
Bot 3, depthBot, has 5 wins and made 0 illegal moves, for a total of 664 points.
Bot 4, middleBot, has 1 wins and made 20 illegal moves, for a total of 114 points.
With 4 bots, This program took 477.471 seconds to finish.
Depth Bot is the reigning champion! At least, for right now.
XXX000---
get transmitted? or is that a 'nobody gets it despite O having won it first'? \$\endgroup\$