@syuji syuji / mj.rb
Created at Fri Mar 03 00:54:22 JST 2023
麻雀牌の山を作る
mj.rb
Raw
# 麻雀牌の山を作る

piType = [
    (1..9).map { |i| "m#{i}" }, # 萬子
    (1..9).map { |i| "p#{i}" }, # 筒子
    (1..9).map { |i| "s#{i}" }, # 索子
    (1..4).map { |i| "f#{i}" }, # 東南西北
    (1..3).map { |i| "g#{i}" }  # 白發中
].flatten

piMnt = []
4.times do |i|
    piMnt += piType.dup
end
piMnt.shuffle!

hand = []
14.times do |i|
    hand << piMnt[i]
end

p hand.sort