38
6
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.
As an aside, have you ever looked at Fire and Ice - there are some tic-tac-toe elements to it... though this also reminded me of scribe.
– None – 2015-05-12T03:34:46.3179 likes and 40 views. I'm impressed! – Loovjo – 2015-05-12T06:13:15.307
5You might want to put a limit on the response time of bots, or bots may take 3 minutes per move while searching all possible future moves. – Logic Knight – 2015-05-12T08:31:42.067
1I've added some rule clarifications to the bit about next move. I have a concern about the data format and one of the rules. Rule 5 from the first section: "If one of the boards becomes filled, it counts as nobodies tile." Is this filled without a winner? i.e. if someone wins the tile previously, and it becomes filled is it nobodies tile? Furthermore, if the bots are stateless (they appear to be) with the state passed in, how does the winner of a board that is
XXX000---
get transmitted? or is that a 'nobody gets it despite O having won it first'? – None – 2015-05-12T13:47:36.757@MichaelT the winner of the board is passed in on the 11th line. I'll edit this part to make it a little bit more clear, however your edit is incorrect. "If a board is won, but there is still space, you still cannot move into one of the open spots." – James – 2015-05-12T15:08:18.020
@DJMcMayhem ok, so the board is frozen as soon as one player wins? A ha! That's in "or one of us has already won board 1" Will correct. – None – 2015-05-12T15:10:15.163
@Ypnypn yes, this is intentional. The boards are 0-indexed, and the 9th (or tenth?) board is the master board. Does my edit make it more clear? – James – 2015-05-12T15:21:51.117
5. If one of the boards becomes filled, it counts as nobodies tile.
This is only if someone didn't win it on the last move on that board, right? – mbomb007 – 2015-05-12T16:49:13.537@mbomb007 yes, I'll edit that in. – James – 2015-05-12T16:57:30.177
@DJMcMayhem: Is Haskell allowed as well? – Willem Van Onsem – 2015-05-12T17:35:20.557
@CommuSoft Probably. I have never run haskell on my laptop before, so I can't guarantee it, but I don't see any reason why not. Let me test it real quick and then I'll add it to the list of "officially" supported languages. – James – 2015-05-12T17:37:31.423
Is there a deadline for this? Meaning, a date for the final tournament? Not sure yet if I should give it a shot, but I certainly wouldn't want to invest the time and then miss the tournament. – Reto Koradi – 2015-05-15T07:51:31.433
@RetoKoradi not really. I guess it just depends on how many submissions I get. – James – 2015-05-15T14:21:32.870
@DJMcMayhem Did you use the current version of my submission? I (and perhaps others) made edits to fix some bugs which might explain the illegal moves. – KSab – 2015-05-15T14:35:54.110