Twixt was developed by Alex Randolph and was very popular in 60s and 70s. More history and details, can be found HERE and THERE.
- Each player in turn places a peg of his color in a vacant hole. The player cannot place a peg in the opponent's border rows.
- A peg links with another peg of the same color if they are a chess knight move away from each other and if the link would not cross an already present opponent's link.
- In the PP variant of Twixt, a link is allowed to cross another link of the same color. But this does not establish a connection.
- During the first turn, the second player has the ability to swap the opponent's peg instead of placing a new peg.
- The swapped peg changes color and is symetrically moved on the board. For example, peg C5 would become E3.
- You connect your two opposite border rows with a continuous chain of pegs.
- There are no vacant hole, and no border connection has been made.
- You play an invalid move.
- You do not respond in due time.
1 line: hisLastPeg One string that indicates where the opponent placed his last peg (D6 or H10 for instance), or FIRST if you are the first to play, or SWAP if the opponent has chosen to swap the first turn.
1 line: numYourPegs One integer that indicates how many of your pegs are present on the board.
numYourPegs lines: yourPeg One string for each of your pegs.
1 line: numYourSegments One integer that indicates how many segments (links) you have on the board.
numYourSegments lines: yourSegPeg1 yourSegPeg2 Two strings for the two ending pegs of each of your segments.
1 line: numHisPegs One integer that indicates how many pegs of your opponent are on the board.
numHisPegs lines: hisPeg One string for each of his pegs.
1 line: numHisSegments One integer that indicates how many segments the opponent has.
numHisSegments lines: hisSegPeg1 hisSegPeg2 Two strings for the two ending pegs of each of his segments.
Allotted response time to output is 1 s for the first turn, then 300 ms for the other turns.
A higher resolution is required to access the IDE