From: Scott Andrechek Date: 2009-08-21T10:19:19+09:00 Subject: New to Classes Hello. I'm new to making and defining your own classes (well really to Ruby in general)and need some of your help with areas of my code. Here is the code for the game: class Die def roll @numberShowing = 1 + rand(6) end def showing @numberShowing end end dice = [Die.new] play=true money= 100 while play==true puts 'You have $' + money.to_s + '. What is your bid?' bid= gets.chomp puts '$' + money.to_s + '-' + '$' + bid.to_s moneytest= money.to_i - bid.to_i while moneytest<=0 puts 'Please enter a valid bid' bid=gets.chomp moneytest= money.to_i - bid.to_i end money=(money.to_i - bid.to_i) puts '$' + money.to_s + ' remaining' puts 'What number would you like to place your bet of ' + '$' + bid + ' on?' number= gets.chomp puts 'Dice roll was....' die = Die.new die.roll puts die.showing if @numberShowing.to_i==number.to_i puts 'Congrats! You made ' + '$' + bid.to_s else puts 'Sorry. You lost ' + '$' + bid.to_s end if (money==0 or money<=0) puts 'Sorry you lose' play==false end end The problems I'm having with it (as you will see if you test it) is that you cannont win money, which I assume is because of my handling of @numberShowing, and that you can't go 'all in'. Any help would be greatly appreciated. -Scott -- Posted via http://www.ruby-forum.com/.