Created
April 30, 2015 07:15
-
-
Save lettas/5e2c5e01f9a2bde077e4 to your computer and use it in GitHub Desktop.
TripleTriadのカードを全パターン生成しちゃう
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| [ | |
| {level:1, pmin:10, pmax:13, nmin:1, nmax:6}, | |
| {level:2, pmin:12, pmax:15, nmin:1, nmax:7}, | |
| {level:3, pmin:15, pmax:18, nmin:1, nmax:7}, | |
| {level:4, pmin:18, pmax:20, nmin:1, nmax:7}, | |
| {level:5, pmin:20, pmax:22, nmin:1, nmax:7}, | |
| {level:6, pmin:20, pmax:23, nmin:1, nmax:8}, | |
| {level:7, pmin:23, pmax:25, nmin:1, nmax:8}, | |
| {level:8, pmin:24, pmax:26, nmin:1, nmax:9}, | |
| {level:9, pmin:24, pmax:26, nmin:1, nmax:10}, | |
| {level:10, pmin:26, pmax:29, nmin:1, nmax:10}, | |
| ].each do |settings| | |
| power_range = (settings[:pmin]..settings[:pmax]) | |
| number_range = (settings[:nmin]..settings[:nmax]).to_a | |
| cards = number_range.repeated_permutation(4).select{|c| power_range.include?(c.inject(:+))} | |
| puts cards.map{|c| [settings[:level], c.inject(:+), c].flatten.join("\t") } | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
出力の例