From: Erik V. <eri...@hc...> - 2005-03-29 15:47:36
|
> I've been thinking about how to approach drawing the company chits on > the stock market. First a point of nomenclature: I have never heard the word "chit" before, and don't know what it means, except (obviously) out of the context where you use it. I'd expect more non-native English speakers like me to have this problem. In the rule books I find "token" in most American and "marker" in most European-originated games, and I would prefer to standardis/ze on one of these two words. I'd personally prefer "marker" for the stock market thingies and "token" for the map (station) ones, but maybe there are better ideas around. > One thing that occurs to me is that perhaps we need model/view > separation on this as well. In other words, the information > about where > the chits are ought to be stored in the StockMarket or > StockSpace class > (I haven't quite decided which yet), and the UI should simply draw the > market based on the information it gets from those classes. Yes, I fully agree, see below. I would say that everything that is part of the game state (and would need to be stored in a save file) is part of the Model. > If we only store the display information in the View portion, I think > there may be problems when we need to save that information to a save > file. > > So, in either StockMarket or StockSpace (probably StockSpace, > i think), > does it make sense to add the ability to store what company > stock chits > are currently occupying the space? Any suggestions on how we should > store this? Does it sound like we need a new object class for this, or > should we use information from an existing object, like > Company perhaps? In the current classes I have included: - in StockSpace: an ArrayList of Companies having their markers (or tokens) there, in top-to-bottom sequence, - in PublicCompany: its currentPrice, which is a StockSpace instance, identifying the location of its stock price marker (or null for companies without priced shares). So the marker's StockSpace and the marked Company have a mutual reference to each other. This is the way I would tend to approach issues like this. And this way we do not need a new class. Erik. |