The Matching Pennies Command Line Protocol

The Matching Pennies Command Line Protocol allows humans or machines to play against other humans or machines using a command-line protocol.

There are four possible recognised ways to interact with the program:

  • H - HEADS
  • T - TAILS
  • R - RESET
  • Q - QUIT
Only the first letter is necessary, and it should be a capital letter at the start of the line.

Lines starting with other letters are ignored. It is conventional to prefix any comment lines with the "hash" symbol, though.

The RESET command is advice that the opponent has changed. It is normally issued by tournament administrators - and not by players.

A transcript of a game against a human follows.

# Play the Matching Pennies game. # Type H for HEADS, T for TAILS, Q to quit. H HEADS - Test - You: HEADS. Me: HEADS. Match! T HEADS - Test - You: TAILS. Me: HEADS. Mismatch! H HEADS - Test - You: HEADS. Me: HEADS. Match! H TAILS - Test - You: HEADS. Me: TAILS. Mismatch! T TAILS - Test - You: TAILS. Me: TAILS. Match! H HEADS - Test - You: HEADS. Me: HEADS. Match! H HEADS - Test - You: HEADS. Me: HEADS. Match! H TAILS - Test - You: HEADS. Me: TAILS. Mismatch! T HEADS - Test - You: TAILS. Me: HEADS. Mismatch! Q
This protocol allows programs written in any programming language to compete in the Matching Pennies tournament - and potentially to win the prize. However, note that the rules about open source state that the tournament organisers must be able to compile the code. If you are developing in an unfamiliar environment, the best way to avoid problems in this area is to contact the organisers before applying.

Examples

The examples directory contains source code of simple random bots in Java and Python. These implement the Matching Pennies Command Line Protocol - and illustrate how to build a simple program that can play the game against a human or a machine - using the protocol.

Server

A Java tournament server for the Matching Pennies Command Line Protocol has been implemented. It is in the current SourceForge source code download. The relevant class is agents.base.BaseWrapper.

Plans

We plan to build Matching Pennies tournament programs in a range of languages.

That way, the The Matching Pennies command-line protocol would only need to be implemented once per language. If this is done, it would allow those interested in writing players to just implement a single function or method.


Tim Tyler | Contact | http://matchingpennies.com/