Last active
August 29, 2015 14:13
-
-
Save greymd/db0ec53d0221d1d76b49 to your computer and use it in GitHub Desktop.
ポーカーのストレートフラッシュ製造機
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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