-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading and writing specialized game formats #470
base: master
Are you sure you want to change the base?
Conversation
This is an excellent start. Some suggestions for next steps:
|
Two questions at this point:
|
Very nice on the refactoring. Yes, we can't at the moment implement write_gbt. We weren't supporting it before, so we don't need to include it now. It's a rather separate discussion to have whether we even want it at all, and if so what arguments it should take. So it deserves its own separate issue. For marking the deprecation and also flagging functions as being new, see the numpydoc style at https://numpydoc.readthedocs.io/en/latest/format.html - also consider See also entries for the new functions
For tests, use parameterised text fixtures (see other test files for examples). This way you can run them with more than one game which would be a good idea - in particular nontrivial games should be tested. For efg/nfg, a good test to focus on is whether the game makes the round trip from game to file back to game correctly. For validating the HTML - it does seem like we ought to do some sort of check but I'm not quite sure we should have our own parser, that feels something like neither here nor there. We might simply at this point confirm that it runs and put the question of the best way to regression test files we don't read in, off for another day. |
afa6fcf
to
df470a5
Compare
…zed formats Reading * `read_efg` - reads an .efg file format * `read_nfg` - reads an .nfg file format * `read_gbt` - reads a .gbt file (XML files produced by the GUI) * `read_agg` - reads an action-graph games file format Writing * `Game.to_efg` - writes an .efg file * `Game.to_nfg` - writes an .nfg file * `Game.to_html` - writes out HTML tables * `Game.to_latex` - writes a .tex file New tests in test_io.py
Tests on reading and writing nfg files are skipped as the input and output text files are not identical when using C++ read and write functions. One of the efg games is skipped for the same reason. Shall we leave it at that for now? |
Add following function:
Reading
read_efg
- reads an .efg file formatread_nfg
- reads a .nfg file formatread_gbt
- reads a .gbt file (XML files produced by the GUI)read_agg
- reads an .agg fileWriting
Game.to_efg
- writes an .efg fileGame.to_nfg
- writes a .nfg fileGame.to_gbt
- writes a .gbt fileGame.to_html
- writes out HTML tablesGame.to_latex
- writes a .tex file