longestRun関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The longest run of tiles from hand that can be laid one after another
against end, in the order they would be laid. A depth-first search over
the hand, bounded by PLAN_STEPS, preferring the heavier run of two the
same length: pips laid are pips that do not count.
インポート
import { longestRun } from "@johnmorrisdotca/domino";
定義
function longestRun(hand: readonly Domino[], end: number): Domino[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
hand | readonly number[] | The canonical tile numbers in one hand. |
end | number | The pip value the next laid tile must match. |
戻り値
number[]
The longest run of tiles from hand that can be laid one after another against end, in the order they would be laid. A depth-first search over the hand, bounded by PLAN_STEPS, preferring the heavier run of two the same length: pips laid are pips that do not count.
例
import { longestRun, tileOf } from "@johnmorrisdotca/domino";
console.log(longestRun([tileOf(1,2),tileOf(2,3),tileOf(3,4)],1));[ 18, 35, 52 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。