Geoff Fortytwo - 2006-05-30

Oh, I forgot to include the code I used to parse. Here are the relevant parts.

    private void doTest() {
        Game game = loadPgn("J:/dwn/chess/bird/bird_norm.pgn");

        int plyIx = 0;
        do {
            Ply ply = game.getLastPly();

            Position srcPly = ply.getSource();
            Position destPly = ply.getDestination();

            Logger.getLogger(getClass()).debug(" MOVE "+
                    srcPly.getLineIndex() +","+ srcPly.getRowIndex()
                    +" "+
                    destPly.getLineIndex() +","+ destPly.getRowIndex()
                    );

            ++plyIx;
            if(plyIx > 20)
                break;

        } while(game.moveOnePlyForward());
    }

    private Game loadPgn(String pgnFilePath) {
        try {
            File pgnFile0 = new File(pgnFilePath);
            PGNFile pgnFile = new PGNFile( new BufferedReader( new FileReader(pgnFile0) ) );
            Game notation = pgnFile.readGame();
            return notation;
        } catch(FileNotFoundException e) {
            Logger.getLogger(getClass()).error("",e);
        } catch( RecognitionException e) {
            Logger.getLogger(getClass()).error("",e);
        } catch( TokenStreamException e) {
            Logger.getLogger(getClass()).error("",e);
        }

        return null;
    }