Revamped manager program and added manual page
authorSam Moore <[email protected]>
Sat, 3 Dec 2011 08:26:36 +0000 (16:26 +0800)
committerSam Moore <[email protected]>
Sat, 3 Dec 2011 08:26:36 +0000 (16:26 +0800)
commit4a3c0478160e7e9b637a12e7cf22f8da61b66ad2
tree57047234aa910e43f2492abec98fc39a1839d07c
parent53a666903d770b14969f542d6548e267e5017b31
Revamped manager program and added manual page

Seperated controllers into AI and human controllers, which inherit from the same base class
Using "human" as an argument instead of an AI program will allow human player. However, the human player has to use the CLI.

I have tried playing a few games, and it is incredibly annoying using the CLI (especially when each turn was printed to stdout - now suppressed).
Usually I accidentally enter the wrong coordinates, or spend 30 seconds trying to work out the coordinates of a piece.
Then when I switch the focus, the SDL window goes blank, and I don't know what the hell is going on.
In conclusion: Should probably add GUI for human players!

Created Game class to manage playing the game, rather than hacking everything into main.cpp
Added argument switches for timeouts, graphics, output file, help, allowing illegal moves, revealing colours etc
Added result lines (output who actually wins... amazing!) The massive spamming output that used to be printed is suppressed (enable with -o stdout/file).

Created manual.txt which is the manual page for stratego (the manager program).
stratego --help will display the page (using "less" - should probably fix for systems without "less").

Changed tokens used for pieces from alphabet characters to digits for the ranked pieces, 's' for the Spy, 'B' for Bombs and 'F' for the Flag.
This makes things clearer. The Spy would be "10", except thats 2 characters, which is a bit awkward!
Didn't change the order of the enum, because thats just asking for trouble and besides, it works.
Changed stratego to output the characters for the piece, instead of an integer rank (except for Flag, Bomb and Spy, no difference).

Need to handle situations where a player has lost all their mobile pieces. Do they lose?
Currently they will be forced to make an illegal move, and the other player wins by "default".

Found mistake in forfax move score calculation that lead to moves having negative scores,
and hence occasionally an illegal move would be chosen as more valuable than legal moves.
Probably fixed. Illegal moves now score -1, so should NEVER be made! Ironically the change seemed to decrease forfax's performance against dummy.
Forfax still seems to make really stupid moves, and I can't see why. Occasionally it does something smart
(attacks Marshal with Spy just after the Marshal reveals itself), but I'm not sure how often these are coincidences.
Even with the devaluing of moves that don't end in combat, Forfax still gets into long cycles of repeated paths with no purpose.
And Forfax NEVER attacks Bombs or the Flag... even if thats all the enemy has, and even if the attacking piece would be a miner.

Updated web page. Considering replacing Protocol Description as is with that written for manual.txt, which I feel is clearer.

Need to make next git commit message shorter...
18 files changed:
manager/Makefile
manager/ai_controller.cpp [new file with mode: 0644]
manager/ai_controller.h [new file with mode: 0644]
manager/common.h [deleted file]
manager/controller.cpp
manager/controller.h
manager/game.cpp [new file with mode: 0644]
manager/game.h [new file with mode: 0644]
manager/human_controller.cpp [new file with mode: 0644]
manager/human_controller.h [new file with mode: 0644]
manager/main.cpp
manager/manual.txt [new file with mode: 0644]
manager/movementresult.h
manager/stratego.cpp
manager/stratego.h
samples/dummy/dummy.cpp
samples/forfax/forfax.cpp
web/index.html

UCC git Repository :: git.ucc.asn.au