A Simple Program in Ruby

Day One

Okay, my attention has been slipping since I woke up this morning, so instead of something web related, I thought I'd talk about programming, specifically Ruby.

Ruby is a very powerful language with many applications, but I'm not going to show you that, mainly because I only know how to use it through the command line. Instead, I'm going to show you how to make a *coughvirtualcough* Money Tree!

Since I feel like being thorough, I'll start with describing how it will work.

  • The tree will grow at the end of each season.
    • The tree will grow a random height based on the amount of rain/sun/snow it gets.
  • The tree will produce money in fall.
    • The tree will produce money after it reaches a certain height as well as taiking into account the amount of rain/sun/snow it has recieved up to that point.
  • We will be able to count the money.
  • We will be able to harvest the money.
  • We will be able to purchase items to make the tree grow better and stronger.
  • The tree will eventually die.
    • The tree will die of neglect or a random natural disaster.
    • The death will happen randomly, but will also be stayed off by certain actions.

And, since I like plugging this tool, I'll show how the planning process looks in FreeMind.

Click to Enlarge

I've streamlined the process a bit, so now I can get to the coding, which will be next time.


Oct 21, 2009 Ruby, Programming, Code Examples