
begin
    puts "\nWelcome to the forest of doom.  Choose a character:"
    print "archer or warrior? "
    char=gets
    c = "archer"
    arc = 0
    war = 0
    b = 0
    if c==char.chomp
        5.times do
            x=rand(2)
            puts "\n-- You are attacked by a bat!"
            puts "Pick a weapon (enter a number) 1 - long bow; 2 - cross bow"
            answer=gets.to_i
            puts "\nYou shoot the bat."
            if x==answer
                puts "\nA hit.  The bat falls to the floor."
                arc = arc.to_i + 1
            else
                puts "\nA miss.  You are defeated."
                b = b.to_i + 1
            end
            puts "\n(Hit enter to continue.)"
            enter=gets
        end
    puts "\n------------------------------------------"
    puts "\nGame over.  You have gained " + (arc.to_f / 10 * 4.5).to_s  + " XP and " + (arc.to_f / 10 * 1.4).to_s + " gold coins."
    puts "\n------------------------------------------"
    else
        5.times do
            x=rand(3)
            puts "\n-- You are attacked by a hobgoblin!"
            puts "Pick a weapon (enter a number) 1 - two-handed sword; 2 - battleaxe; 3 - bombchu"
            answer=gets.to_i
            puts "\nYou attack the hobgoblin."
            if x==answer
                puts "\nSuccess. The hobgoblin crumples onto the floor."
                war = war.to_i + 1
            else
                puts "\nYou are defeated."
                b = b.to_i + 1
            end
            puts "\n(Hit enter to continue.)"
            enter=gets
        end
    
    puts "\n------------------------------------------"
    puts "\nGame over.  You have gained " + (war.to_f / 10 * 6.2).to_s  + " XP and " + (war.to_f / 10 * 2.5).to_s + " gold coins."
    puts "\n------------------------------------------"
    end
puts "Do you want to play again? (y/n)"
end until gets.chomp=="n"
