MahjongCoreEngine

EXECUTIVE SUMMARY
This library functions as the primary matrix controller and multidimensional array conversion processor for live-tick simulation models. It provides structural utilities to convert raw multi-element datasets into localized counts, offering deterministic memory alignment optimized for Pine Script v6's structural limitations.
EXPORTED FUNCTIONS & QUANTITATIVE LOGIC
- hand_to_counts(string[] hand): Translates an arbitrary array of string elements (Unicode vectors) into a standardized 34-element fixed-integer array representing frequency distribution. This reduces the search space for combinations from factorial complexity to linear static constraints, preserving Abstract Syntax Tree (AST) overhead.
- is_standard_form(int[] counts): A deterministic combinatoric explorer that evaluates if the 34-element matrix satisfies the standard terminal grouping format: 4 sets (melds) and 1 pair (eye). It runs recursive backtracking memory pointers to guarantee 100% mathematical validity under live compilation loops.
概要
本ライブラリは、ライブティック・シミュレーションモデルにおける主要なマトリックスコントローラおよび多次元配列変換プロセッサとして機能します。生の複数要素データセットを局所的なカウント配列に変換する構造的ユーティリティを提供し、Pine Script v6の制限に最適化された決定論的なメモリ配置を実現します。
エクスポート関数と定量的ロジック
- hand_to_counts(string[] hand): 任意の文字列配列(Unicodeベクター)を、出現頻度分布を表す標準化された34要素の固定整数配列へと変換します。これにより、組み合わせの探索空間を階乗の複雑さから線形静的制約へと縮小し、コンパイル負荷(ASTオーバーヘッド)を保護します。
- is_standard_form(int[] counts): 34要素のマトリックスが、標準的な終了状態グループ形式(4面子1雀頭)を満たしているかを決定論的に評価する組み合わせ探索エンジンです。再帰的なバックトラッキング・メモリポインタを実行し、ライブコンパイル環境下で100%の数学的妥当性を保証します。
追加:
get_all_tiles()
counts_to_hand(counts)
Parameters:
counts (array<int>)
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
I specialize in pushing basic, fundamental concepts to their absolute limits. Dedicated to engineering noise-free indicators that reveal true market mechanics and logical edges. Clarity over https://clutter.https://www.youtube.com/@alt.analyst