-
Notifications
You must be signed in to change notification settings - Fork 0
Connect 2
Connect 2 is a deep game of skill requiring cunning, tactical prowess, ...
Connect 2 is a terrible, terrible game with one design goal: to illustrate how games work on this site. It plays with exactly the rules of Connect 4, only the goal is to connect 2 pieces horizontally, vertically, or diagonally instead of 4. Players alternate turns dropping their pieces into a grid that has 7 columns and 6 rows. Pieces fall all the way to the bottom of the board; a column that is filled to the top is an invalid move.
The engine alternates between each player, doing the following:
- Issuing the word "Move" on a single line to a player
- Receiving a number from 1-7 on a single line from a player
- Issuing the text "Opponent played #" (the # replaced by the player's move) on a single line to that player's opponent
- Alternating the player to move
... until the game is over.
If a player makes a move that is invalid, the engine should disqualify the player, and award the win to his opponent. Bot programs should be prepared to read any line starting with "#" as a comment from the engine as to why he is being disqualified.
This game can never end in a draw. The winner is the first player to connect 2 of their pieces horizontally, vertically, or diagonally. The winner receives a payoff of 1; the loser receives a payoff of 0.
From engine perspective:
=>A: Move
A: 1
=>B: Opponent played 1
=>B: Move
B: 1
=>A: Opponent played 1
=>A: Move
A: 3
=>B: Opponent played 3
=>B: Move
B: 2
=>A: Opponent played 2
(end: B wins)
From A's perspective:
E: Move
=>E: 1
E: Opponent played 1
E: Move
=>E: 3
E: Opponent played 2
(dies)
The replay should be stored as an JSON file, in the following format:
{
"Connect2": {
"Players": [
{ Name: "Bilbo", Author: "Bill" },
{ Name: "Botamus", Author: "Hippo" }
],
"Moves": [ 1, 1, 3, 2 ],
"Results": [ 0, 1 ]
}
}