#!usr/bin/env ruby
# -*- coding: utf-8 -*-

kazu=["0","1","2","3","4","5","6","7","8","9","10","11","12","13"]

mark=["♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣","♥","♠","◆","♣"].shuffle




puts"high and low スタート!!"

while true
  sleep(1)
  puts"何が出るかな?"
  sleep(2)
  x=rand(kazu.length)
  a=mark.shift
  y=rand(kazu.length)
  b=mark.shift

  if x==0||y==0

    puts"あぁっ!!"
    puts"これ、トランプじゃなくて、、、"
    sleep(3)
    puts"百人一首かるただ!"
    sleep(2)
    puts"----------数分後-----------"
    sleep(1)
    puts"・・・失礼しました"
    sleep(1)
    puts"気を取り直しまして"
    sleep(1)

    redo
  end
  printf("%s%d\n",a,x)
  sleep(1)

  if x<y

    puts"high and low?"
    puts"1:high 2:low"     
    answer=gets.chomp
    puts"どっちかな?"
    sleep(3)
    printf("%s%d\n",b,y)
    sleep(2)
    
    if answer=="1"

      puts"大当たり〜"
      puts"もう一度できるよ!"
      redo

    elsif answer=="2"

      puts"ハズレ〜"
      puts"また挑戦してね"

      break
      

    end
  end

  if x>y

    puts"high and low?"
    puts"1:high 2:low"     
    answer=gets.chomp
    puts"どっちかな?"
    sleep(3)
    printf("%s%d\n",b,y)
    sleep(2)
    if answer=="1"

      puts"ハズレ〜"
      puts"またやってみてね"
      break

    elsif answer=="2"

      puts"大当たり〜"
      puts"もう一度できるよ!"

      redo


    end
  end
end










