From baa4d9d6440dac63367a80b88b1c466deb9263a9 Mon Sep 17 00:00:00 2001 From: Sam Moore Date: Mon, 18 Feb 2013 20:53:07 +0800 Subject: [PATCH] Update website a bit --- web/agent.html | 52 ++++++++++++++++ web/agent_python.html | 29 +++++++++ web/agent_text.html | 142 ++++++++++++++++++++++++++++++++++++++++++ web/enter.html | 19 ++++++ web/get.html | 88 ++++++++++++++++++++++++++ web/index.html | 6 +- web/using.html | 108 ++++++++++++++++++++++++++++++++ 7 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 web/agent.html create mode 100644 web/agent_python.html create mode 100644 web/agent_text.html create mode 100644 web/enter.html create mode 100644 web/get.html create mode 100644 web/using.html diff --git a/web/agent.html b/web/agent.html new file mode 100644 index 0000000..29e0166 --- /dev/null +++ b/web/agent.html @@ -0,0 +1,52 @@ + + + + + UCC::Progcomp 2013 - Writing an Agent + + + + + +

What API do I use?

+ +

If you are not using python, your agent will use the text based API

+

If you are using python, you should use the python API. But you don't have to.

+ +
+ +

I've read that, but don't know where to start

+ +
    +
  1. Pick a language. Python is recommended for beginners.
  2. +
  3. Look at the sample agents. Here is the sample python agent
  4. +
  5. Copy sample and rewrite amazingly awesome quantum chess algorithm of supreme domination
  6. +
  7. Profit
  8. +
+
+ +

That was too long; I didn't read it

+ +

Read the sample python agent instead.

+ +
+ +

Policy on Threading and Forking

+ +

Don't do it. It is not allowed. Use a single thread like a real man/woman/robot.

+ +
+

This API seems terrible and I want to use threads

+ +

Too bad. Write your own competition.

+ +
+ +

Page last updated 2013-02-18 by matches

+ +

The UCC Website

+

UCC::Progcomp 2013

+ + + + diff --git a/web/agent_python.html b/web/agent_python.html new file mode 100644 index 0000000..5414918 --- /dev/null +++ b/web/agent_python.html @@ -0,0 +1,29 @@ + + + + + UCC::Progcomp 2013 - Writing an Agent - python + + + + +

Python API

+ +

Be sure to read and understand the rules before reading this page.

+

+

The sample python agent implements this API

+

You may still use the text based API if you insist.

+ + +

Overview

+ + + +
+ +

Page last updated 2013-02-18 by matches

+ +

The UCC Website

+

UCC::Progcomp 2013

+ + diff --git a/web/agent_text.html b/web/agent_text.html new file mode 100644 index 0000000..1bb5efc --- /dev/null +++ b/web/agent_text.html @@ -0,0 +1,142 @@ + + + + + UCC::Progcomp 2013 - Writing an Agent - Text based + + + + +

Text based API

+ +

Be sure to read and understand the rules before reading this page.

+

+

All agents (even python ones) are stand alone programs which qchess spawns instances of to play a game. Qchess sends state updates and requests moves from players through pipes. From the agent's point of view, all it has to do is read commands from stdin and respond to stdout.

+

Note: Although pipes are pretty damn awesome, they unfortunately always get buffered by default, with a stupidly large size like 4KB. This means that it is unlikely a program will work unless it is able to unbuffer its stdin/stdout streams. In some languages this is trivial. In others it is probably impossible. If you want to use a language where it is impossible, please tell the organiser. Even if I have to rewrite half of the code dealing with external agents, I will make it work.

+ +
+ +

Overview

+ +

In the following, lines prefixed with "<< " indicate input to the agent, lines prefixed with ">> " indicate output.

+

The end line character is a unix new line character '\n'. There is no carriage return.

+

A token prefixed with '$' is taken to be variable, whilst all other tokens are to be interpreted literally.

+ +
+ +

Game start

+ +

<< $colour

+

Where:

+
    +
  1. $colour is either "white" or "black" and indicates the colour the agent will be playing as.
  2. +
  3. The agent should make no response to this message. If it does, it will be declared illegal.
  4. +
+ +
+ +

Request: Selection

+ +

<< SELECTION?

+

>> $x $y

+

<< $x $y $index $type + +

Where:

+
    +
  1. $x and $y are the x and y co-ordinates of the piece that the agent wishes to select.
  2. +
    1. $x and $y must be the co-ordinates of a square that is on the board, and occupied by a piece belonging to the agent.
    2. +
      1. The top left square is (x,y) = (0,0). The bottom right is at (x,y) = (7,7).
      2. +
      3. Qchess does not recognise standard chess square names (eg: E5)
      4. +
      5. A piece belongs to the agent if its colour matches that of the agent.
      +
    +
  3. An invalid selection results in the game ending with the offending agent declared illegal
  4. +
  5. A valid selection results in a response from qchess; see Update: Agent selects a piece
  6. +
+ + +
+ +

Request: Movement

+ +

<< MOVE?

+

>> $x $y

+ +

If an agent selects a piece that cannot move, it will not receive this request before its next selection.

+ +

Where:

+ +
    +
  1. If an agent selected a piece that couldn't move, it will not receive this request before another selection request
  2. +
  3. $x and $y are the co-ordinates of the destination square
  4. +
      +
    1. The selected piece must be able to move into the square, and the square must be unoccupied or occupied by a piece of the opposing colour
    2. +
    3. If the square was occupied by a piece of the opposing colour, that piece is "taken" and removed from the game
    4. +
    5. If the "taken" piece was the opposing king, the agent will win the game.
    6. +
    7. The agent must always make a move
    8. +
    +
  5. An invalid move results in the game ending with the offending agent declared illegal.
  6. +
  7. A valid selection results in a response from qchess; see Update: Agent moves a piece
  8. +
+ + +
+ +

Update: Agent selects a piece

+ +

<< $x $y $index $type

+ +

Where:

+
    +
  1. $x and $y are the x and y co-ordinates of the selected piece
  2. +
  3. $index is either "0" or "1" and indicates which of its two states the selected piece is in.
  4. +
  5. $type is a string indicating what the state of the piece actually is.
  6. +
    1. This string is one of: "king", "queen", "rook", "knight", "bishop" or "pawn".
    2. +
    3. The piece's next move will obey traditional chess movement rules for a piece of this type.
    +
  7. The agent should not respond to this message, or it will be declared illegal +
+ +
+ +

Update: Agent moves a piece

+ +

<< $x1 $y1 -> $x2 $y2

+ +

Where:

+
    +
  1. The piece will have been been selected immediately prior to being moved.
  2. +
  3. $x1 and $y1 are the x and y co-ordinates of the piece's original square.
  4. +
  5. $x2 and $y2 are the x and y co-ordinates of the piece's destination square.
  6. +
  7. Qchess does not provide any indication as to whether the move captured a piece or not
  8. +
+ + +
+ +

Game ends

+ +

<< QUIT

+ +

Where:

+ +
    +
  1. The agent should immediately exit cleanly without sending any response.
  2. +
  3. Agents which do not exit after 2 seconds shall be sent SIGKILL
  4. +
+ +
+ +

Notes:

+
    +
  1. The "update" messages give no indication as to which player performed the selection or movement. However this is trivial for agents to keep track of.
  2. +
  3. Agents can expect to receive an "update" message after responding successfully to the corresponding "request"
  4. +
  5. If no request was made, the agent can assume the "update" is due to the action of the opponent.
  6. +
+
+

Page last updated 2013-02-18 by matches

+ +

The UCC Website

+

UCC::Progcomp 2013

+ + + + diff --git a/web/enter.html b/web/enter.html new file mode 100644 index 0000000..db437c9 --- /dev/null +++ b/web/enter.html @@ -0,0 +1,19 @@ + + + + + UCC::Progcomp 2013 + + + + +
+ +

Page last updated 2013-02-18 by matches

+ +

The UCC Website

+

UCC::Progcomp 2013

+ + + + diff --git a/web/get.html b/web/get.html new file mode 100644 index 0000000..8366224 --- /dev/null +++ b/web/get.html @@ -0,0 +1,88 @@ + + + + UCC::Progcomp 2013 - Getting qchess + + + + +

qchess is a python2.7 implementation of Quantum Chess

+ +

tl;dr

+ + + + + + + + + + +
Binary Script (requires python2.7 and pygame1.9)
Windows 32 bit qchess.py
Linux 64 bit qchess.py
+ +

Warning: Some things in the windows version will not work.

+

Warning: The actual competition will be run on linux. If your program doesn't work on linux, you may not be able to enter.

+ + +
+ + +

Git

+

The best way to do things is to use git and clone the repository at git://git.ucc.asn.au/progcomp2013.git. Run "git pull" everytime a major change is announced.

+ + +
+ + +

Files and Directories

+ + + +
+ +

qchess.py

+ + + +
+ +

Compiled Binaries

+ +

Warning: I am no longer testing the binaries. I believe the linux binary works, but the Windows binary might not.

+

If they work for you, that is awesome, but I recommend installing python and using the python script.

+

You'll probably want to enter in python, since the python script gives you a lot of useful functions.

+ +

On the other hand... , if you have problems with an incompatable version of python, try the binaries!

+ +
+ +

Page last updated 2013-02-18 by matches

+ +

The UCC Website

+

UCC::Progcomp 2013

+ + + + diff --git a/web/index.html b/web/index.html index e9e56a6..d876706 100644 --- a/web/index.html +++ b/web/index.html @@ -39,8 +39,8 @@
  • Join the mailing list
  • Join the #progcomp channel on IRC
  • -
  • Obtain a copy of the qchess program
  • -
  • Using the qchess program
  • +
  • Obtain a copy of the qchess program
  • +
  • Using the qchess program
  • Writing an agent for the qchess program
  • Entering the competition
  • @@ -60,7 +60,7 @@
    -

    Page last updated 2012-01-30 by matches

    +

    Page last updated 2013-02-18 by matches

    The UCC Website

    UCC::Progcomp Website

    diff --git a/web/using.html b/web/using.html new file mode 100644 index 0000000..24f96b5 --- /dev/null +++ b/web/using.html @@ -0,0 +1,108 @@ + + + + + UCC::Progcomp 2013 - Using qchess + + + + +Assuming you have obtained qchess, here is how to use it. + +

    GUI - Playing a game

    + +

    You'll probably want to play against sample agents to learn the game. Or you'll want to play against your own agent to test it.

    + +
      +
    1. Start qchess
    2. + +
    3. Choose players
    4. + +
    5. Play / Watch game
    6. + +
    + +

    Advanced stuff - command line options

    + +

    On unix systems, running `./qchess.py --help' should show you a help file.

    +

    On windows (or on unix) you can also find the help file in data/help.txt

    +

    Or you can click here

    + +

    I'll explain some options here anyway, because no one reads help files. Also it might not be up to date.

    + + + +

    Output of qchess

    + +

    If you want to be clever and do something like evolutionary code, you'll need to play lots of games and do stuff based on the output.

    + +

    qchess outputs lines of the form: `colour [result]'

    + + +
    +

    The actual competition "simulator" is a bash script that runs lots of qchess instances and creates scores for each agent based on the outputs.

    + + +
    + +

    Page last updated 2013-02-18 by matches

    + +

    The UCC Website

    +

    UCC::Progcomp 2013

    + + + + + + -- 2.20.1