bhlangonijr / chesslib

chess library for legal move generation, FEN/PGN parsing and more
Apache License 2.0
229 stars 80 forks source link

Support for java.io.Reader and java.io.Writer compatible implementations for reading and writing PGN and FEN #83

Open seize-the-dave opened 2 years ago

seize-the-dave commented 2 years ago

Hi,

I noticed that the Board class has responsibility for loading and outputting FEN strings, and that you have a PgnHolder for reading and writing PGNs to files. I wondered if I could contribute a more java.io idiomatic way of doing this, e.g.

Iterator<Game> iter = new PgnParser(reader).iterator();
Game game = iter.next();
PgnWriter writer = new PgnWriter(appendable);
writer.write(game);

What do you think?