blob: c19e7f30d65031f41b9aa4b1d12b290669f73eca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#start ← 4‿8
start ← 3‿10
scores ← +` {𝕩+10×𝕩=0} 10| start +` (+´)⎉1 200‿2‿3 ⥊ 1+↕100
end ← ⊑ / (»⊸<∨`) «⥊scores≥1000
loser ← end ⊑ ⥊scores
roll ← 3×2+ end
•Show loser × roll
Move ← { ⟨roll,player,⟨pos,score⟩⟩:
pos2 ← {1+10|roll+𝕩-1}⌾(player⊸⊑) pos
⟨pos2, score + pos2 × player=↕≠pos2⟩
}
f ← 3↓<˘⍉(↕∘≠ ≍ ⊣) ≠¨⊔+˝⍉>⥊1+↕3⥊3
Play ← {
⟨player,⟨pos,score⟩⟩: ∨´score ≥ 21 ? score ≥ 21 ;
⟨player,st⟩: +´ { ⟨val,frq⟩: frq × Play (¬player)‿(Move val‿player‿st) }¨ f
}
•Show ⌈´ Play 0‿⟨start,⟨0,0⟩⟩
|