From: Thufir Date: 2007-11-04T04:45:02+09:00 Subject: Re: dragons and factorials (keyboard input) I googled, didn't find the answer, posted, googled more, found the answer: C:\code> C:\code> C:\code> C:\code> C:\code>type makeDragon.rb require 'Dragon' require 'factorial' aDragon = Dragon.new aDragon.toString number=0 print "\n\n\nthe Dragon will calculate a factorial now." puts "\nenter an integer " #number=gets number = gets.chomp.to_i # print "\n\n\n" + number + "\n\n" answer=fact(number) print "Dragon replies\n\n" print answer #print fact(number) C:\code> C:\code>makeDragon.rb This Dragon ------------------- Life: 1340 Strength: 451 Charisma: 1020 Weapon: 939 the Dragon will calculate a factorial now. enter an integer 11 Dragon replies 39916800 C:\code> A bit chagrined, Thufir ps: I'm thinking about class, inheritance and so forth. I'm going to review another thread where I was asking about the ruby equivalent to "static class methods" for, specifically, the factorial which I want ensure cannot be instantiated. I know it's an object, because everything's an object in Ruby, but have to think about that one. I think I also want to make some private methods, and a friend was suggesting to insert some error if the Dragon has low intelligence! :)