22
4
NOTE: This challenge is currently dead, as I'm unable to install the languages needed to run a match. If someone else has the time and interest to do it, I'm not opposed.
See the bottom of the post for a leaderboard.
This is a semi-cooperative king-of-the-hill challenge, where the bots construct paths through a two-dimensional grid graph. The bot who controls the nodes with the most traffic is the winner. However, it takes more than one bot's resources to actually build a connecting path, so the bots will have to work together -- to some extent.
Gameplay
In the following, let N > 0
be the number of bots in play.
The Grid
The game is played on a two-dimensional integer grid of size ⌊4/3N2⌋ × ⌊4/3N2⌋
, whose bottom left coordinate is at (0,0)
. Each coordinate (x,y)
with 0 ≤ y < ⌊4/3N2⌋-1
has outgoing edges to the three coordinates (x-1,y+1)
, (x,y+1)
, and (x+1,y+1)
above it, where the x
-coordinates are taken modulo ⌊4/3N2⌋
. This means that the grid wraps around at the east and west edges. Every bottom coordinate (x,0)
is a source, and every top coordinate (x,⌊4/3N2⌋-1)
is a sink.
The following picture shows an 8 × 8
grid.
Each vertex of the graph is either inactive, active, or broken. All vertices start inactive, and can be activated by bots, which will then be their owners. Also, bots can break vertices, and they cannot be repaired.
Turn Order
A turn consists of a destruction phase and an activation phase. In the destruction phase, each bot may break one inactive vertex. That vertex is broken from then on, and may not be activated by anyone. In the activation phase, each bot may activate one inactive vertex. From then on, they own that vertex, and it cannot be reactivated by anyone else. Several bots may own a single vertex, if they all activate it on the same turn. In each phase, the vertex selections are done simultaneously.
Scoring
One round lasts for exactly N2
turns. After this, the round is scored as follows. From each active source vertex, we perform N
times a randomized depth-first search along the active vertices (meaning that the children of each vertex are visited in a random order). If a path is found from the source to some sink, then for all vertices along that path, every owner of the vertex gets one point.
The entire game lasts for 100 rounds, and the bot with the most points overall is the winner. I may increase this number, if the variance of the scores is too high.
Additional Rules
- No messing with the controller or other submissions.
- At most one submission per contestant.
- No external resources, except one private text file, wiped clean at the beginning of the game.
- Do not design your bot to beat or support specific opponents.
- Provide commands to compile and run your bot. Any compiler/interpreter that's freely available for Debian Linux is acceptable.
The Controller
The controller is written in Python 3, and can be found in GitHub. See the README file for detailed instructions. Here's an API to get you started:
- Bots are started at the beginning of each round, and persist until the end of the round. The communicate with the controller via STDIN and STDOUT, using newline-terminated messages.
BEGIN [num-of-bots] [num-of-turns] [side-length]
is input at the beginning.DESTROY [turn]
is input at the beginning of each destruction phase. Your bot shall respond with eitherVERTEX x,y
to choose a vertex, orNONE
.BROKEN [turn] [your-choice] [other-choices]
is input at the end of each destruction phase. The order of the other bots is randomized at the beginning of each game, but stays fixed during it. The choices are presented asx,y
orN
.ACTIVATE [turn]
andOWNED [turn] [your-choice] [other-choices]
are the equivalents of the above for the activation phase, and have the same semantics.SCORE [your-score] [other-scores]
is input at the end of the game.- Your bot has 1 second to analyze the results of a phase and choose the next vertex, and 1 second to quit after given the score. I will test the submissions on my relatively old laptop, so it's better to leave some margin here.
Please remember to flush your output buffer. Not doing so may hang the controller in some environments.
Leaderboard
Updated 3/13/2015
Peacemaker is up and running, and Funnelweb received an update too. The scores jumped up by an order of magnitude. Connector exceeded the time limit in two games.
Funnelweb: 30911
Connector: 18431
Watermelon: 3488
Annoyance: 1552
Explorer: 735
Checkpoint: 720
Random Builder: 535
FaucetBot: 236
Peacemaker: 80
The full log with ASCII art graphics can be found in the controller's repository, in graphical_log.txt
.
Some observations:
- Connector can very easily be stopped by breaking a single vertex in front of it. I suspect Annoyance frequently does this. However, it currently makes little sense because only Connector can conceivably construct a path.
- Watermelon can get a decent score by simply happening to be on a connecting path (since the DFS is very likely to use its vertices).
- Explorer likes to grow vines from the watermelons.
- The updated Funnelweb gets really good scores, since Connector usually latches onto it in the lower half of the grid.
- The games are getting quite long, the average round taking about 25 seconds on my machine.
I will be a very sad wolf if I see any Emo Wolf submissions...
– Alex A. – 2015-02-19T21:09:46.297Does the rightmost column lack forward arrows intentionally? – feersum – 2015-02-19T21:15:38.493
1@Alex I tried to design the challenge so that suicidal bots won't mess everything up. Three well designed bots should always be able to construct a valid path, if they work together. – Zgarb – 2015-02-19T21:42:44.397
2@Zgarb Suicide shouldn't mess it up, but a couple troll-bots working together could probably also block all paths, ruining the game. – Geobits – 2015-02-20T04:51:01.733
2@CarpetPython Active nodes cannot be destroyed. – Zgarb – 2015-02-20T08:55:27.890
@feersum The picture is now fixed. – Zgarb – 2015-02-20T17:58:43.013
I'm having a problem running the code
– Pureferret – 2015-02-21T20:07:49.533@Pureferret I patched the controller. Even if it still doesn't work, the error messages should be a little more meaningful. – Zgarb – 2015-02-23T08:32:16.347
Ok give it a go later! – Pureferret – 2015-02-23T08:38:47.640
@Zgarb What happens if a bot activates a vertex already owned by itself? – Thrax – 2015-02-24T15:21:07.557
@Thrax In that case, its choice is interpreted as
NONE
. – Zgarb – 2015-02-24T16:36:16.5931It seems we are unlikely to see any interesting games with the current players and rules. I suggest you change the rules slightly to create opportunities for interesting games. Changing the grid size to 1.5N^2 instead of 2N^2 should be good and not confuse existing robots too much. – Logic Knight – 2015-02-28T06:29:04.610
I looked at the complete log. So actually the scores are just from one round with positive score? The rest don't have connecting path. I support CarpetPython suggestion to reduce the grid size. – justhalf – 2015-03-05T08:21:48.190
1@justhalf That's true. The games in the log were actually played with the further reduced grid size of
4/3*N^2
, and even there, the bots had problems forming valid paths. However, Connector was temporarily disqualified due to an error, and now that it has been fixed, I expect the games to be more interesting. I'll run another batch tonight. – Zgarb – 2015-03-05T09:52:14.673Thanks for running another 100 games. Connector is doing very well. I was a little puzzled about game 85 though. Funnelweb (d) scored zero yet there were several
d
nodes in the paths from sources to sinks. Is there a bug there or have I misunderstood the scoring? – Logic Knight – 2015-03-06T01:54:15.3571@CarpetPython: Note that the score is counted by taking random path from source to sinks. Looking at the configuration of the
d
nodes, I think it's unlikely for any of thed
nodes to be selected in a path (note that there is only two ways to get tod
nodes from bottom-to-top: line 5798 and 5801 in the log, out of many paths since theg
nodes make the path width wide) – justhalf – 2015-03-06T03:09:47.093@justhalf: thanks. I think I see now. There was only one source with a path, so only 7 "score packets" made the trip. Because the
d
nodes were away from the centre of the paths, probability was against being selected. The funnelweb may need some tinkering. – Logic Knight – 2015-03-06T04:07:02.230@Zgarb, thanks for running more games. Will you run other games if we modify our bots, or would you rather move on to different activities? I would be keen to see how bots evolve to cooperate and compete, but I am aware this takes some of your time. – Logic Knight – 2015-03-06T04:15:04.640
1@CarpetPython I'll continue running the games as long as there are new/modified bots, though there may sometimes be delays of a few days. – Zgarb – 2015-03-06T05:47:52.103