summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Sam Moore [Fri, 2 Dec 2011 05:17:14 +0000 (13:17 +0800)]
Fixed "forfax" sample AI
Forfax now plays a fairly mediocre game of Stratego
He usually beats the dummy AI. Usually. After a while.
Sometimes he gets stuck in a loop where he repeats the same moves over and over again.
Sometimes he attempts to move bombs or the flag (???)
He also never actually captures the flag; he just destroys all the enemy pieces before going into a loop.
This is probably due to the movement value being very low for moving over pieces that are likely to be bombs
And when all mobile pieces are destroyed, the remainder are seen to be likely to be bombs.
The segfault was caused by much stupidity involving a for loop in Board::ForgetPiece and the continue statement
Changed to a while loop to fix.
Since Forfax works (Although it plays pretty badly) I will probably move onto other things for a while.
Sam Moore [Thu, 1 Dec 2011 10:54:44 +0000 (18:54 +0800)]
Mostly messing with "forfax" AI
It would be nice to have an AI that doesn't segfault.
Currently segfault caused by Board::ForgetPiece.
valgrind outputs a lot of wierd crap about std::vector and uninitialised values
Uninitialised values created by std::vector::push_back()
All I am pushing is a simple pointer (Piece*), so I don't know WHY uninitialised values happen...
The std::list used in MakeMove is somehow using the same memory as the std::vectors of the board, which is causing invalid reads
Stupid, stupid stdlib.
I think that once that is fixed, forfax is pretty much done. I'd like to see how well it plays, but... segfaults.
I also fixed dummy to take into account the modified turn protocol which prints piece ranks. dummy just reads them and ignores them.
I plan to make the manager program more useful
- Enable human players
- Add command line arguments for things like timeouts, graphics on/off etc
- Read a game from a file (so that games can be viewed after they are run)
I need to go through the manager program carefully and make sure that the way AI programs quit actually works
Ideally the AI program has a short period to exit gracefully before it is killed
I think for some reason the AI program always just gets killed.
At some point I need to setup a VM for this. I should probably do that.
I also might change minor things like the tokens (from random characters to digits + a few characters) and the internal ordering of the enum Piece::Type
Sam Moore [Wed, 30 Nov 2011 04:36:18 +0000 (12:36 +0800)]
Modified Turn Response Protocol, added handling for SIGPIPE, changed placeholder images
The "outcome" of a move is now listed as:
TYPE [ATTACKER_RANK] [DEFENDER_RANK]
Where ATTACKER_RANK and DEFENDER_RANK will be present if TYPE is one of: KILLS, DIES, BOTHDIE, and indicate the ranks of the pieces involved.
This involved adding a class MovementResult, which stores the ranks of pieces in addition to an enum, replacing the enum Board::MovementResult
The sample agent "forfax" was causing broken pipes, which caused the manager program to exit.
I added a handler for SIGPIPE in manager/main.cpp to ensure that the manager program reports a DEFAULT victory to the other AI, and exits gracefully.
However, I still don't know WHY forfax causes broken pipes, but hopefully its a problem with forfax and not with the manager program.
I edited the images used by the graphical display to show the ordered ranks of the pieces, rather than some obscure characters.
Unfortunately I have just realised that the enum used for Piece::Type stores ranks in the wrong order.
In the actual game, LOWER numbers are better, in my enum, HIGHER numbers are better.
To make things more confusing, I made the printed ATTACKER_RANK and DEFENDER_RANK correspond to the traditional numbering, not the enum numbering...
Sam Moore [Tue, 29 Nov 2011 09:02:13 +0000 (17:02 +0800)]
First actual commit
More details to follow :P
Sam Moore [Tue, 29 Nov 2011 08:33:31 +0000 (16:33 +0800)]
More testing than is perhaps necessary
Samuel Moore [Tue, 29 Nov 2011 07:05:35 +0000 (15:05 +0800)]
This is a test
UCC git Repository :: git.ucc.asn.au