Package 'convlog'

Title: Read Mahjong Logs From 'tenhou.net/6' Format
Description: Offers wrappers for the 'convlog' crate from 'mjai-reviewer' <https://github.com/Equim-chan/mjai-reviewer> that can directly read mahjong logs from 'tenhou.net/6' format into R lists.
Authors: Akiru Kato [aut, cre], Equim chan [cph] (Author of the 'convlog' crate)
Maintainer: Akiru Kato <[email protected]>
License: Apache License (>= 2)
Version: 0.0.4
Built: 2025-01-02 04:11:29 UTC
Source: https://github.com/paithiov909/convlog

Help Index


Read and parse 'tenhou.net/6' format log

Description

Read and parse 'tenhou.net/6' format JSON files while transforming them into 'mjai' format.

Usage

read_tenhou6(file, .progress = FALSE)

read_remote_mjlog(logid, .progress = FALSE)

read_mjlog(file, .progress = FALSE)

Arguments

file

A character vector. This argument is simply passed to scan(), so each element can be either a path to a local file or a URL.

.progress

Whether to show progress bar for purrr::map_chr().

logid

A character vector that represents identifiers of log files.

Details

read_remote_mjlog() internally reads remote JSON files corresponding to logid, and converts them into the same format as read_tenhou6(). Note that read_remote_mjlog() is rate-limited to 2 requests per second to access the server.

Alternatively, read_mjlog() can directly read local 'MJLOG' XML files while converting them into 'mjai' format. This function returns almost the same result as read_tenhou6(), but they are not exactly the same. As far as I have noticed, the differences are:

  • tehais in game_info are not arranged.

  • reach_accepted events are always inserted immediately after the reach event in this implementation, even when the reach indicator was melded by another player. Due to this, numbering style of round_id is also different than in read_tenhou6().

  • tsumogiri detection is much stricter than in read_tenhou6(). Even after melds, if the discard is the same as the previous draw, it is considered a tsumogiri.

  • ura_markers are not revealed when there is no "doraHaiUra" attribute.

Value

A named list that contains following elements:

  • game_info: A tibble that contains information about the games.

  • round_info: A tibble that contains information about rounds.

  • paifu: A tibble that represents paifu.