PHP関数名しりとりをチートして倒します
下記を開発者向けコンソールに入れます
(async () => {
/** @type {Record<string, [string, string]>} */
const data = await fetch("/regex.json").then(r => r.json())
/** @type {Record<string, boolean>} */
const sayed = {}
const sleep = (/** @type {number} */ s) => new Promise(r => setTimeout(r, s))
const action = async () => {
const ipt = document.querySelector("input")
if (!ipt) return console.log("no ipt")
const divs = [...document.querySelectorAll(".text-center")]
.some(s => s.textContent.match(/^記録/iu))
if (divs) return console.log("exists div")
const list = [...document.querySelectorAll(".rounded-xl > .p-2")]
.map(r => (r.textContent || '').trim())
list.forEach(s => sayed[s] = true)
const startWords = Object.values(data).filter(s => !sayed[s]).reduce((r, p) => {
const s = p[0].slice(0, 1).toLowerCase()
return { ...r, [s]: (r[s] || 0) + 1 }
}, {})
/** 次の選択肢の数を数える */
const rate = (/** @type {string} */ word) => startWords[word.slice(-1).toLowerCase()] || 0
const w = ipt.placeholder.trim().slice(0, 1)
const ws = Object.values(data).map(s => s[0])
.filter(k => !sayed[k] && k.startsWith(w) && /[a-z]$/ui.test(k))
if (!ws.length) return console.log("no words", { ws, w })
ws.sort((q, w) => rate(q) - rate(w))
ipt.value = ws[0] // 次の選択肢がもっとも少ないワードを選ぶ
// ipt.value = ws[Math.floor(Math.random() * ws.length)] // ランダムにすると長く続いて面白い
ipt.dispatchEvent(new CustomEvent("input", { bubbles: true }))
await sleep(5)
ipt.closest("form").dispatchEvent(new CustomEvent("submit", { bubbles: true }))
await sleep(500)
action()
}
action()
})()