# 麻雀牌の山を作る require 'bundler' Bundler.require piType = [ (1..9).map { |i| "man#{i}" }, # 萬子 (1..9).map { |i| "pin#{i}" }, # 筒子 (1..9).map { |i| "sou#{i}" }, # 索子 (1..4).map { |i| "ji#{i}" }, # 東南西北 (5..7).map { |i| "ji#{i}" } # 發白中 ].flatten piMnt = [] 4.times do |i| piMnt += piType.dup end piMnt.shuffle! hand = [] 14.times do |i| hand << piMnt[i] end hand.sort! # 画像リストを作る imgList = hand.map do |item| "pai-images/#{item}-66-90-l.png" end p imgList image = Magick::ImageList.new(*imgList) image = image.append(false) t = Time.now image.write("result#{t.strftime("%Y%m%d_%H_%M_%S")}.png")