Here's an interesting problem I thought of the other day, which involves bits of code competing against other bits of code not just in a property that the code has, but by playing a game against those other bits of code.
Your task is to build a program that takes the current state of a Go board, and determines what move to make or to pass.
Your program will accept the following as input:
19 lines, each with 19 characters, representing the pieces currently on the Go board. A character of
0
represents an empty square,1
is black, and2
is white.Two numbers representing the number of prisoner pieces each player has (black, then white).
One number representing whose turn it is to move (black or white). As above,
1
is black, and2
is white.
and output one of the following:
A pair of coordinates
a b
representing the coordinates at which to move.1 1
is the top-left square, and the first and second numbers represent moving down and to the right respectively.The string
pass
, which represents a move to pass.
For example, the program may receive the following input:
0000000000000000000
0000000000000000000
0000000000000000000
0001000000000002000
0000000000000000000
0000000000000000000
0001210000000000000
0000100000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0002000000000001000
0000000000000000000
0000000000000000000
0000000000000000000
0 0 1
which represents a game where only a few moves have been played.
Then the program might output 6 5
, which means "put a black stone on the point 6th from the top and 5th from the left". This would capture the white stone at 7 5
. The state of the board would then change to:
0000000000000000000
0000000000000000000
0000000000000000000
0001000000000002000
0000000000000000000
0000100000000000000
0001010000000000000
0000100000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0000000000000000000
0002000000000001000
0000000000000000000
0000000000000000000
0000000000000000000
1 0 2
(Note that although a white stone was captured, it counts as a prisoner for black.)
Your code must additionally satisfy the following properties:
If your program is given the same input state, it must always produce the same output. This is the determinism of the Go AI. It must not have a random component.
Your program must not take more than approximately 60 seconds to determine what move to make. This rule will not be strictly applied due to variations in computing power, but it must make a move in a reasonable amount of time.
Your program's source code must not exceed a total of 1 megabyte (1,048,576 bytes).
Your program must always make legal moves. Your program cannot make a move where a stone already exists, and cannot place a piece that would result in a group of its own stones being captured. (One exception to the rules for the purposes of this challenge is that a program is allowed to create a position that was originally there - because it is only given the current position of a board, it cannot be expected to store which moves had been made before.)
Your submission will then play in an all-play-all tournament against all the other submissions, in a game of Go where the state of the board begins as empty, and each program takes turns being fed the position of the board and making a move.
Each pair of submissions will play two rounds - one round with each player being black. Because the AIs in this problem are completely deterministic, two of the same AIs playing together will always result in exactly the same game being played.
Conditions for a win are as such:
If your program plays to the end of the game, the Chinese scoring rules of Go will be used to determine the winner. No komi will be applied.
If your program plays to the point that an earlier state is reached, thus causing an infinite loop, the two programs will be declared to have tied.
Your submission will be scored by how many points it scores against other submissions. A win is worth 1 point, and a tie is worth half a point. The submission with the most points is the overall winner.
This is a king-of-the-hill challenge, in which anybody can post a new entry at any time, and the standings will be re-evaluated periodically when this happens.