I have been doing a dice study on one of the sites and use Gnubg to parse files using python. The site outputs MAT files – unfortunately because of client bugs there are a good percentage of MAT files with Invalid moves (This isn’t Gnubg’s fault). I had a suspicion that Gnubg was importing matches with Illegal moves but Gnubg didn’t identify some moves as invalid. After some experimentation and sanity checks in my python code, I was able to identify a bug during import.
During Import (import.c) a Call is made to ApplyMoves from IsValidMove. Unfortunately ApplyMoves checks that each individual move is valid, but doesn’t identify incomplete/partial moves as illegal. For example lets say I have a position where this is a legal move from a mat file:
5) 33: 6/3 6/3 8/5 8/5
All 4 of the moves are legal, and IsValidMove will return 1 (True). Unfortunately ApplyMove also sees this as valid:
All of these will return true when run through IsValidMove. The problem is ISValidTrue doesn’t check if the entire set of moves makes sense (Partial moves are not seen as illegal). This isn’t specific to doubles.
I’m not sure, but I think we should consider calling GenerateMoves (or a function that is similar) and then compare the imported moves with the generated valid move list. GenerateMoves of course doesn’t necessarily consider partial moves as valid. This should replace the current code inside of import.c’s IsValidMove function.
Michael
[Prev in Thread]
Current Thread
[Next in Thread]
[Bug-gnubg] Import / Illegal move bug,
Michael Petch<=