59
10
You probably know Conway's Game of Life, the famous cellular automaton invented by mathematician John Conway. Life is a set of rules that, together, allow you to simulate a two-dimensional board of cells. The rules decide which cells on the board live and which ones die. With some imagination, you could say that Life is a zero-player game: a game with the objective to find patterns with interesting behavior, like the famous glider.
A zero-player game... Until today. You are to write a program that plays the Game of Life - and plays it to win, King of the Hill-style. Your opponent (singular) of course tries to do the same. The winner is either the last bot with any live cells, or the player with the most live cells after 10000 generations.
Game rules
The rules are almost the same as normal (B3/S23) Life:
- A live cell with fewer than two friendly neighbors dies from starvation.
- A live cell with two or three friendly neighbors survives.
- A live cell with more than three friendly neighbors dies from overpopulation.
- A dead cell with exactly three neighbors of the same player comes alive to fight for that player provided there are no enemy neighbors.
...but after each generation, both you and your opponent get the opportunity to intervene. You can awake up to a maximum of 30 cells to fight for you. (Who goes first is decided by the server.)
The board is a (x,y) cells square. All squares are initially dead. The borders do not wrap around (this is not a torus-shaped world) and are permanently dead.
This is is a contest in the spirit of Battlebots and Core Wars. There is a central server that will run bots and it can be found here
Protocol
The arena server speaks a simple JSON protocol communicated through argv
Where Values is a JSON encoded string
y_size
: the maximum y coords of tiles before they vanishx_size
: the maximum x coords of tiles before they vanishtick_id
: the current tick numberboard
: a dictionary with keys in the form '(y,x)' and values in the formbot_id
(int)bot_id
: tiles in the board with this id are yours
Example:
{"y_size":2000,"x_size":2000,"board":{},"bot_id":1,"tick_id":1}
Telling the server your choice:
- Send the server a list of tiles to turn to your colour.
- Only those that are empty will be changed
- Nested coords list format
[[0,0], [0,1], [100,22]...]
NOTE: Your bot doesn't have to update the tiles at all - the server does the updating itself
Competition rules
- If your implementation fails to follow the protocol, the turn it does will be forfeited; The server will assume no change in state
- You are not allowed to willfully take advantage of a fault in the arena server.
- Have your AI decide on moves in a sane time. Please send your next move as fast as reasonably possible.
- Finally, please be nice to the server. It's there for your enjoyment.
- Not following these rules can lead to disqualification.
- In the event of a tie, both players have 1 win added to their total
Running the controller yourself
The source for the controller can be found here. There are 2 ways of running the controller:
- Competition mode (terminal)
- Setup with
python3 get_answers.py
- Run an all v all competition with each bot pitting it against every other.
- Setup with
- Testing mode (GUI)
- Run
python3 nice_gui.py
- Click
Pull Answers
- If you want to add your own answer to try it before posting, click
File -> Add manual answer
and find the file and choose the language it's written in. - If your language isn't present ping me and I'll try to get it installed on the server I will run it on (installation and running instructions would be nice too!)
- Choose 2 bots to pit against each other
- Click
Run
- Watch the game...
- Run
- Installation
- Requires python3
- get_answers requires bs4 and html5lib
- controller requires a way of running .sh files (MinGW on windows)
Scoring
The bot with the most wins starting from 12/07/2016
(12th July)14/07/2016
(14th July, couldn't work out how to run a bot) wins.
Help with the controller/gui can be asked in this chat room
This question has been in development since 2014 and was the most upvoted question in the sandbox. Special Thanks goes to Wander Nauta (original author and concept), PPCG Chat (comments and help) and anyone who commented in the sandbox post (more comments).
25Huh, I thought this would never make it out of the sandbox. Great! – Luis Mendo – 2016-06-28T21:23:37.173
Typo: 12/06/2016 (12th July) – Luis Mendo – 2016-06-28T21:32:48.933
so you didn't use my server? – TheDoctor – 2016-06-28T21:34:40.227
@muddyfish sorry- this seems like tech support, but the gui is blank, and the get_answers does not return anything for me. – Magenta – 2016-07-01T10:24:39.113
Is the bot id garunteed to be a single character? – Rohan Jhunjhunwala – 2016-07-01T14:36:47.817
@RohanJhunjhunwala the bot id will be either
1
or2
– Blue – 2016-07-01T16:40:56.190@Magenta Did you press the pull answers button in the gui and click yes? That should fill it with answers – Blue – 2016-07-01T16:42:16.760
There is a bug where bots timing out (my Ruby bot was timing out a lot) cause crashes in the server code. I've sent a pull request to fix it.
– Value Ink – 2016-07-01T19:51:18.340@muddyfish when i pull answers, that works, and the different bots can be selected. However, the rest of the gui is blank. – Magenta – 2016-07-01T20:02:14.500
You need to click run? Try moving the window about if that doesn't work, if stuff starts miraculously appearing I have no idea how to fix it – Blue – 2016-07-01T21:03:04.613
What is the exact format of the "dictionary" in the board – Rohan Jhunjhunwala – 2016-07-02T14:52:21.520
Is it {'(y1,x1)',id1,'(y2,x2)',id2,(y3,x3),id3} etc... – Rohan Jhunjhunwala – 2016-07-02T14:54:09.077
If my bot tries to activate more than 30 cells what happens? – Rohan Jhunjhunwala – 2016-07-02T14:54:27.030
Are additional cells ignored or do i lose a turn? – Rohan Jhunjhunwala – 2016-07-02T14:54:54.970
4+1. You deserve the AED award for bringing this great question out of the sandbox! – agtoever – 2016-07-03T18:59:40.827
@RohanJhunjhunwala the dictionary format can be found in the chat link in the question, additional cells get filtered out. agtoever Thanks! – Blue – 2016-07-03T19:21:48.490
Sorry I am so needy, but if someone would like to take a look at the "Troll Bot", and run it. I would like to see it tested so I can optimize it. The client arena wont work as I'm on a windows machine and the hardcoded command limit will prevent me from seeing the whole game. If anyone would let me know if it worked for them. That would be great! – Rohan Jhunjhunwala – 2016-07-04T01:14:17.660
@RohanJhunjhunwala why won't it work on windows? – Rɪᴋᴇʀ – 2016-07-05T23:50:34.790
@EᴀsᴛᴇʀʟʏIʀᴋ Windows commandline commands have a hardcoded limit of 8191 (to my knowledge, there might be a shell that beats the limit). The input to these programs is a command line argument, and considering the 1000x1000 board the input passed in (which is formatted to list every single active cell) can easily fly past that limit – Value Ink – 2016-07-06T01:04:55.250
1@KevinLau-notKenny oh, okay. Can you run a command in a file? – Rɪᴋᴇʀ – 2016-07-06T01:16:40.953
If I try to activate a cell thats already activated is that ignored? – Rohan Jhunjhunwala – 2016-07-07T01:15:23.710
Rohan, yes. It still counts as one of the 30 though – Blue – 2016-07-07T05:33:03.627
@muddyfish if you are having trouble running all the bots together you could probably get a cloud9 partition and run it from there? I'm just sad that my bot is the only one that uses a strategy based on the opponent's board state instead of dropping things wherever
– Value Ink – 2016-07-12T20:52:14.637The problem's been fixed, just testing now. – Blue – 2016-07-12T21:02:21.643
It's a real shame that there weren't too many bots for this one... I feel like the Windows problem was a big issue, but there's nothing that can be done about that now – Value Ink – 2016-07-19T00:38:34.673
@muddyfish You should select mark the winning bot as accepted and post the scores if the competition is indeed over as of July 14th. – mbomb007 – 2016-07-22T18:45:28.543
I'm not accepting yet because I'm waiting on trollbot. I still can't run it – Blue – 2016-07-22T18:48:27.880
@muddyfish When are the scores going to be up? – Magenta – 2016-08-20T06:18:37.613
1@Magenta When I get them (I'd completely forgotten about this even though it's been in a constantly open tab), I'm running it now – Blue – 2016-08-20T10:00:37.960