#!/usr/local/bin/ruby # ******************************************** # * Taito Tetris Mino Generator * # * Usage: taitotet.rb outfile * # * 2021.05.14 * # ******************************************** o1file = ARGV.shift if (o1file == nil) puts " Usage: segatet.rb out_file" exit end o1f = open(o1file, "w") p o1file seed = 0 loop = 2500 # 2500ƒ~ƒm * 4 / 10 = 1000ƒ‰ƒCƒ“ # magic1 = 0x4e6d magic2 = 0x41c6 magic3 = 0x3039 for lp in 1..loop do tl = seed & 0xffff th = (seed >> 16) & 0xffff t0 = (magic1 * tl) t0 = t0 + (((magic2 * tl) & 0xffff) << 16) t0 = t0 + (((magic1 * th) & 0xffff) << 16) t0 = t0 + magic3 t0 = t0 & 0xffffffff seed = t0 t1 = t0 & 0xffff t2 = (t0 >> 16) & 0xffff t3 = ((t1 ^ t2) & 0x3f) % 7 case t3 when 0 then mino = "I" when 1 then mino = "L" when 2 then mino = "J" when 3 then mino = "S" when 4 then mino = "Z" when 5 then mino = "T" when 6 then mino = "O" else mino = "ERROR" end o1f.printf("%08X %s\n",seed,mino) end o1f.close