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...
Showing
- manager/controller.cpp 32 additions, 21 deletionsmanager/controller.cpp
- manager/controller.h 2 additions, 2 deletionsmanager/controller.h
- manager/forfax 1 addition, 0 deletionsmanager/forfax
- manager/images/piece10.bmp 0 additions, 0 deletionsmanager/images/piece10.bmp
- manager/images/piece11.bmp 0 additions, 0 deletionsmanager/images/piece11.bmp
- manager/images/piece12.bmp 0 additions, 0 deletionsmanager/images/piece12.bmp
- manager/images/piece13.bmp 0 additions, 0 deletionsmanager/images/piece13.bmp
- manager/images/piece2.bmp 0 additions, 0 deletionsmanager/images/piece2.bmp
- manager/images/piece3.bmp 0 additions, 0 deletionsmanager/images/piece3.bmp
- manager/images/piece4.bmp 0 additions, 0 deletionsmanager/images/piece4.bmp
- manager/images/piece5.bmp 0 additions, 0 deletionsmanager/images/piece5.bmp
- manager/images/piece6.bmp 0 additions, 0 deletionsmanager/images/piece6.bmp
- manager/images/piece7.bmp 0 additions, 0 deletionsmanager/images/piece7.bmp
- manager/images/piece8.bmp 0 additions, 0 deletionsmanager/images/piece8.bmp
- manager/images/piece9.bmp 0 additions, 0 deletionsmanager/images/piece9.bmp
- manager/main.cpp 48 additions, 21 deletionsmanager/main.cpp
- manager/movementresult.h 34 additions, 0 deletionsmanager/movementresult.h
- manager/program.cpp 13 additions, 4 deletionsmanager/program.cpp
- manager/program.h 2 additions, 0 deletionsmanager/program.h
- manager/stratego.cpp 23 additions, 19 deletionsmanager/stratego.cpp
Please register or sign in to comment