Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ポーカーのストレートフラッシュ製造機
# Macの場合shufではなくgshufをつかってください。
yes | xargs bash -c "echo {'♦','♥','♣','♠'}' '{1..13} | xargs -n 2 | tr ' ' '\t' | shuf" | \
egison -F1,1s -s '(match-all-lambda
(multiset [string integer])[
<cons [$s $n]
<cons [,s ,(- n 1)]
<cons [,s ,(- n 2)]
<cons [,s ,(- n 3)]
<cons [,s ,(- n 4)]
>>>>>[
[s n] [s (- n 1)] [s (- n 2)] [s (- n 3)] [s (- n 4)]
]])'
# Result
# [["♠" 9] ["♠" 8] ["♠" 7] ["♠" 6] ["♠" 5]]
# [["♠" 8] ["♠" 7] ["♠" 6] ["♠" 5] ["♠" 4]]
# [["♠" 8] ["♠" 7] ["♠" 6] ["♠" 5] ["♠" 4]]
# [["♠" 10] ["♠" 9] ["♠" 8] ["♠" 7] ["♠" 6]]
# [["♠" 7] ["♠" 6] ["♠" 5] ["♠" 4] ["♠" 3]]
# [["♠" 7] ["♠" 6] ["♠" 5] ["♠" 4] ["♠" 3]]
# [["♠" 9] ["♠" 8] ["♠" 7] ["♠" 6] ["♠" 5]]
# [["♦" 7] ["♦" 6] ["♦" 5] ["♦" 4] ["♦" 3]]
# [["♠" 10] ["♠" 9] ["♠" 8] ["♠" 7] ["♠" 6]]
# [["♠" 11] ["♠" 10] ["♠" 9] ["♠" 8] ["♠" 7]]
# [["♠" 6] ["♠" 5] ["♠" 4] ["♠" 3] ["♠" 2]]
# [["♣" 8] ["♣" 7] ["♣" 6] ["♣" 5] ["♣" 4]]
# ...
# ...
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.