Published
Edited
Jun 10, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
shantenList = [...baseShanten.values()].filter((n) => !pairsShanten.has(n.id)).sort(compSort).slice(8)
Insert cell
Insert cell
Insert cell
Insert cell
compSort = (a, b) => a.st - b.st || b.draw - a.draw || b.id.localeCompare(a.id)
Insert cell
Insert cell
//computed = compositions.map(good)
// ([c, p, t, _]) => 8 - c * 2 - Math.max(4 - c, p + t) - Math.max(Math.min(p + t + c - 4, 1), 0))
Insert cell
good = ([c, p, t, loose]) => 8 - c * 2 - (p + t - ((!p && ((c + t) > 4)) ? 1 : 0))
Insert cell
runk = ([c, p, t, loose]) => 8 - c * 2 - (p+t+c)
Insert cell
shantenList.filter((n) => n.st !== runk(n.composition)).map((n) => [runk(n.composition), n.st, ' ', ...n.composition])
Insert cell
// use the mj template string for convenience
mj`1234m`
Insert cell
// haha
mj`19m19s19p1234567z`
Insert cell
// nine gates
parse(mj`1112345678999m`)
Insert cell
parse(mj`1111234m233p`)
Insert cell
parse(mj`2345m2339p145s33z`)
Insert cell
parse(mj`5m8p55s`)
Insert cell
parse(mj`1299p378s2z`)
Insert cell
parse(mj`1247m789p0s35z8m`)
Insert cell
//parse(mj`44m2389p23477s246z`)
Insert cell
//parse(mj`147m266p15s24567z7s`)
Insert cell
//parse(mj`4445556661m`)
Insert cell
Insert cell
parse(mj`34440666789998s`)
Insert cell
//parse(mj`78m24588p478s255z3p`)
Insert cell
//parse(mj`233m44p13z`)
Insert cell
//parse(mj`33m3487p1236s`)
Insert cell
//parse(mj`12346m6799p1268s`)
Insert cell
// 3shanten
parse(mj`345s44m122689p13z`)
Insert cell
// 2shanten
parse(mj`345s44m122689p33z`)
Insert cell
// 1shanten
parse(mj`1222m1245789p11s`)
Insert cell
// 3shanten
parse(mj`2359p12267m5552z`)
Insert cell
// 2shanten
parse(mj`7799m578p6s11336z`)
Insert cell
// 2shanten
parse(mj`2368m13567p68s11z`)
Insert cell
//parse(mj`19m19p19s1234567z`)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more