Client API to communicate with Letterpress Battle Server API
Letterpress is a great iPhone/iPad game by Loren Brichter. After playing Letterpress happily for several hours, @baotuo and I decided to build a cheater to get all usable words in one game. And the faster one wins.
And after the solver project, which @baotuo's won the first round and I won the second, we decided to continue the competition with game AIs. A tool to monitor and tune the AIs is need by both of us, and that's why ‘Letterpress Battle’ (aka LPB) comes from.
The main purpose of LPB is to let the game AIs build by me and @baotuo to battle together with a common set of APIs. You can fight the AIs too if you like. ## LPB Client API
Two class is provided in this API.
LPBClient, which support the following server API
* create - Create a game with a 25-characters board
- list - List all games
- join - Join a game
- move - Take a move
- resign - Resign a game
- show - Show game statistics
The other is
LPBConsole, which is a interactive to play the game in console.
An runnable example can be found in Letterpress Solver project.
The main concept is like below:
var program = require'commander'lpb = require'lpb-client';programversion'0.0.1'option'-s, --server [url]' 'Base URL of the server'option'-p, --player [player]' 'Unique player ID'parseprocessargv;if programserver && programplayerc = lpbLPBConsoleprogramserver programplayer;// logic to handle the move// logic to init the game board// logic to init the game boardcon'join' prepareBoard;con'ourmove' takeMove;con'theirmove'applyMove;cemit'ourmove';;cstart;elseprogramoutputHelp;