C++ Python Shell
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits ahead of nifigase:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Corners in different programming languages.

Game engine.

Game engine is run by ./ script.
Usage: `./ MAP PLAYER1 PLAYER2` where:
 - MAP is path to map file. Use maps/default.yaml if not sure.
 - PLAYER1/2 is command line to run bot or - to play for that player manually.

To play with your friend: ./ maps/8x8x15.yaml - -

To play against demo 1-turn bot: ./ maps/8x8x10.yaml - "python"

To make two bots play against each other: ./ maps/8x8x10.yaml "python" "python"

Bot protocol.

Bot is just a program that reads board state on stdin and outputs moves on stdout. Protocol is stateless in a sense
that your bot will always get complete board state and always ought to respond with a complete move. There is no
"!you-play-for 1" or partial moves or whatever.

Board state (bot input) looks like:

!board 1 8

What it means:
 - "!" means a command to bot. There is only one command 'board' right now.
 - "1" is player chip (mark). First player has chip "1", second has chip "2". Empty cells have chip "." (period).
 - "8" is number of lines in board. After first line, your bot must read this number of lines.

Bot should parse next 8 lines and produce a move which satisfies game rules (see wikipedia links on top).

Here how a valid respond looks like:

@turn 4:1-5:1

What it means:
 - "@" is a response from bot. There is only one response 'turn' right now.
   If you want to express "i give up" - just close stdout.
 - "4:1" is a starting point. 4 is X coordinate, 1 is Y. Coordinates are 1-based, so top-left corner is 1:1.
 - "-" is step delimiter. Your move may contain as many valid steps as possible.
   This is valid turn for board above: 3:1-3:3-2:4-1:5.

You can supply as many spaces around all tokens as you want. This is valid response: @turn   4 : 5   - 5:   1

*Warning* bot MUST always produce a valid turn (according to game rules). The game stops after first invalid turn.