Reputation: 51
Suppose I have multiple AI programs for a particular board game, all implemented in different languages, and want to have them compete against each other without a human intermediary. How would I go about this?
I imagine that this is a common problem for AI researchers, hobbyists, game playing competitions, etc.
Is there a common architecture? Perhaps the AIs run as separate processes, and communicate with a central "board" process via sockets?
Upvotes: 1
Views: 184
Reputation: 4308
Sockets are a possibility, but I do use pipes. The board program sends the current state (as a string) through the AI STDIN and the AI answers with an action through STDOUT. The board program updates the game state and this process is alternated between players. I had students compete using Java and C this way. Here is the source code for the board if you want to know how to do that in C. Here is an example player written in C, and here in Java.
Upvotes: 1
Reputation: 18902
I don't think there is a common protocol. GGTP, a General Gaming Text Protocol by Michel Quenault and Tristan Cazenave is very interesting because describes the difficulties you've to deal with designing a general solution and has many references BUT it is not
So you have to fall back on ad hoc protocols.
For Chess there are the Chess Engine Communication Protocol (aka Xboard/Winboard protocol) and Universal Chess Interface (UCI).
With the years the Xboard protocol has grown and now supports standard chess games along with various chess variants, including the world's major forms of chess (Xiangqi, Shogi, Makruk) as well as western variants.
Both are free to use without license fees.
For Go there is Go Text Protocol (FTP)
For checkers / draughts there are CheckerBoard API and DamExchange Protocol
Upvotes: 3