<commit_before>package lila.round

import scala.concurrent.duration._
import scala.math.{ min, max, round }

import play.api.libs.json.Json

import lila.game.{ Pov, Game }
import lila.pref.Pref

final class JsonView(baseAnimationDelay: Duration) {

  def playerJson(pov: Pov, version: Int, pref: Pref, apiVersion: Int) = {
    import pov._
    Json.obj(
      "game" -> Json.obj(
        "id" -> gameId,
        "started" -> game.started,
        "finished" -> game.finishedOrAborted,
        "clock" -> game.hasClock,
        "clockRunning" -> game.isClockRunning,
        "player" -> game.turnColor.name,
        "turns" -> game.turns,
        "startedAtTurn" -> game.startedAtTurn,<commit_msg>mobile API: provide FEN and PGN moves<commit_after>package lila.round

import scala.concurrent.duration._
import scala.math.{ min, max, round }

import play.api.libs.json.Json

import lila.game.{ Pov, Game }
import lila.pref.Pref

import chess.format.Forsyth

final class JsonView(baseAnimationDelay: Duration) {

  def playerJson(pov: Pov, version: Int, pref: Pref, apiVersion: Int) = {
    import pov._
    Json.obj(
      "game" -> Json.obj(
        "id" -> gameId,
        "fen" -> (Forsyth >> game.toChess),
        "moves" -> game.pgnMoves.mkString(" "),
        "started" -> game.started,
        "finished" -> game.finishedOrAborted,
        "clock" -> game.hasClock,
        "clockRunning" -> game.isClockRunning,
        "player" -> game.turnColor.name,
        "turns" -> game.turns,
        "startedAtTurn" -> game.startedAtTurn,
{'fraction_non_alphanumeric': 0.1405335068314899, 'fraction_numerical': 0.0, 'mean_word_length': 2.769607843137255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '2872449', 'n_tokens_mistral': 531, 'n_tokens_neox': 517, 'n_words': 114}