From: Jacob Fugal Date: 2006-03-21T02:30:42+09:00 Subject: Re: [QUIZ] Space Merchant (#71) On 3/20/06, Timothy Bennett wrote: > James (or whoever else is doing station.rb), how are you representing > cargo and passengers, and where are you putting them in the player? > I was just starting to work on classes to represent items and people > that can be found and/or used on planets, and realized that there may > be a bit of overlap between items found on planets and bought at > stations, so they should at least be the same duck type. I was > thinking that they'd be stored in player[:cargo] and player[:passengers] I'm working on an implementation of Station and just representing cargo items as symbols. Ie. the Station has a @trading hash keyed by :machinery, :organics, etc. (whatever the world builder populates the station with). When the player docks at the station, they see what's available for what prices and are presented with a Buy/Sell/Exit choice. When they, for instance, Buy, the Station will call two methods on the Player: Player#pay(price) and Player#load_cargo(good, quantity) where 'good' is the symbol representing that good. As such, I don't need to know anything about the Player's representation, I just require that Players visiting my Station provide the appropriate methods. This representation of goods by symbols of course assumes that a transported good has no state or operations beyond classification. Jacob Fugal