<commit_before>package karballo.pgn

import karballo.Board
import karballo.Move
import java.util.*

object PgnImportExport {

    /**
     * Parses a PGN and does all the moves in a board
     */
    fun setBoard(b: Board, pgnString: String) {
        val game = PgnParser.parsePgn(pgnString)
        if (game!!.fenStartPosition != null) {
            b.fen = game.fenStartPosition!!
        } else {
            b.startPosition()
        }

        for (gameNode in game.pv!!.variation) {
            if (gameNode is GameNodeMove) {
                val move = Move.getFromString(b, gameNode.move, true)
                b.doMove(move)
            }
        }
    }

    @JvmOverloads fun getPgn(b: Board, whiteName: String?, blackName: String?, event: String? = null, site: String? = null, result: String? = null): String {
        var whiteName = whiteName
        var blackName = blackName
        var event = event
        var site = site
        var result = result

        val sb = StringBuilder()

        if (whiteName == null || "" == whiteName) {
            whiteName = "?"
        }
        if (blackName == null || "" == blackName) {
            blackName = "?"
        }

        if (event == null) {
            event = "Chess Game"<commit_msg>Remove @JvmOverloads<commit_after>package karballo.pgn

import karballo.Board
import karballo.Move
import java.util.*

object PgnImportExport {

    /**
     * Parses a PGN and does all the moves in a board
     */
    fun setBoard(b: Board, pgnString: String) {
        val game = PgnParser.parsePgn(pgnString)
        if (game!!.fenStartPosition != null) {
            b.fen = game.fenStartPosition!!
        } else {
            b.startPosition()
        }

        for (gameNode in game.pv!!.variation) {
            if (gameNode is GameNodeMove) {
                val move = Move.getFromString(b, gameNode.move, true)
                b.doMove(move)
            }
        }
    }

    fun getPgn(b: Board, whiteName: String?, blackName: String?, event: String? = null, site: String? = null, result: String? = null): String {
        var whiteName = whiteName
        var blackName = blackName
        var event = event
        var site = site
        var result = result

        val sb = StringBuilder()

        if (whiteName == null || "" == whiteName) {
            whiteName = "?"
        }
        if (blackName == null || "" == blackName) {
            blackName = "?"
        }

        if (event == null) {
            event = "Chess Game"
{'fraction_non_alphanumeric': 0.11150935882118677, 'fraction_numerical': 0.0, 'mean_word_length': 1.7818383167220377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2487088', 'n_tokens_mistral': 747, 'n_tokens_neox': 730, 'n_words': 203}