Last active
June 4, 2021 07:33
-
-
Save youz/84237fe147f1a7d7100936afb9baa765 to your computer and use it in GitHub Desktop.
usage: ruby dice.rb 8 5 | ruby judge.rb | sed -f nko.sed
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
ndice = $*[0].to_i | |
rounds = $*[1].to_i | |
rounds.times { | |
puts ndice.times.map{(rand(6)+1).to_s}*" " | |
} |
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
#!ruby -an | |
puts [$F*" "]+%w(641 642 342 5342 142 1414 51414).select{|w|/#{("1".."6").map{|c|c+c*w.count(c)+"*"}*""}/=~$F.sort*""} |
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
y/123456/ckmnou/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment