I generally struggle with coding, but this book has helped tremendously. Until I reached the things to try sections of Classes. I am unsure of this Dispatch Method and further research is not clearing it up much for me. I have made my dragon program interactive but before I go any further on it I wanted some feedback on the way i am making it interactive….
def whatToDo puts "What do you want to do with Norbert???" puts "Press 1 to Shake the Dragon" puts "Press 2 to Feed the Dragon" puts "Press 3 to Walk the dragon" puts "Press 4 to put the Dragon to bed" puts "Press 5 to toss the dragon in the air" puts "Press 6 to rock the dragon to sleep" @action = gets.chomp if(@action == "1") shakeBabyDragon else puts "notworking" end end def shakeBabyDragon puts "You shake " + @name + " out of frustration." @shakes += 5 passageOfTime end
Is this what you had in mind for the assignment or am I missing something?