SOI 2015, Creativity Task "Bazaar"
====================================

Server by benjamin@soi.ch

Usage
-----
In a terminal, run a command like this
java -jar bazaar-server.jar [-game A D G] [-player N playerCommand1 playerCommand2 ... playerCommandN | -playerfile file] [-id playerID1 playerID2 ... playerIDN | -idfile file] [-log file]

You have to replace the variables by actual values. Their meaning is:

A				number of auctions
D				number of rounds (diamonds) per auction
G				amount of gold available per auction
N				number of players
playerCommandX	command to run the program playing player X
playerIDX		id(display name) of player X
file			path to a file

You have to specify at least gameinfos (-game) and player infos (-player or -playerfile). The other arguments are optional. If no ids are provided the players are named "Player1", "Player2", ..., "PlayerN".

Examples
--------
In order to run the server you first have to open a shell and navigate to the directory of the server:

cd path/to/server

To specify the bots by arguments, start the server like this:
java -jar bazaar-server.jar -player 2 sample-bots/botC.bin sample-bots/botC.bin -id Stofl Sam -game 5 10 100

You can also provide a file with the necessary player informations. Create a file players.txt with one player per line, for example:

sample-bots/botC.bin
python sample-bots/bot.py
sample-bots/botCpp.bin

The same works with the ids (display names). Create a file ids.txt with one id per line, for example:

BotC
Python
BotCpp

You can then start the server like this:
java -jar bazaar-server.jar -playerfile players.txt -idfile ids.txt -game 5 10 100

If you want to the server to write the gamelog to a file, use:
java -jar bazaar-server.jar -playerfile players.txt -idfile ids.txt -log log.txt -game 5 10 100
or:
java -jar bazaar-server.jar -playerfile players.txt -idfile ids.txt -game 5 10 100 > log.txt

Sample-Bots
-----------
In the directory 'sample-bots' you can find implementations of the basic functionality in various programming languages. If your favorite language is missing: just let us know!

The sample bots distribute the available gold randomly on the different rounds. If you want to always generate the same random numbers to make it easier to debug, you should use a constant seed (e.g. srand(0) in C/C++) for the random number generator. Most sample bots implement a constant seed. If you want different numbers every time you start your bot you can use for example the time as seed.

Visualization
-------------
You can analyze the resulting game by opening the 'visualization.html'-file in your favorite web browser. You need to paste the server output into the 'Log' field on the bottom and click 'Load'. You can then go back and forth in the game ('next' & 'prev' buttons), go to a specific point in the game ('auction' & 'round' fields) or let it play on it's own ('Start' button, control the speed with the field to the right (#ms per round))

Hint
----
Programs can write debug output to their stderr and this output is copied to stderr of the server.

Questions?
----------
Do not hesitate to contact us if you have any questions or problems: info@soi.ch
