From: Erik V. <eri...@hc...> - 2005-02-27 20:25:16
|
In a previous attempt to send this to the list with a zip file, the mail was refused because of that. So this time the zip is omitted, but Brett should have got it. Erik. > -----Original Message----- > From: Erik Vos [mailto:eri...@hc...] > Sent: 27 February 2005 20:26 > To: 'rai...@li...'; 'Brett Lentz' > Subject: First test case > > OK, I've created some testable stuff. > Not sure how to deliver this, I'm copying this directly to Brett > in case attachments will not reach the list. > > This zip file contains 4 classes: > * StockPrice - new, represents one square (or whatever) on a > stock chart, and its properties (colour, ledge etc.) > * StockChart - new, has all the squares and does the basic > movements (moveRightOrUp, moveUp etc.), > * StockMarket - updated. My preference is to let this class > have methods for the high-level > actions that affect the price: Payout, Withhold, SoldOut (end > of SR), Sell (n shares). > Of course for 1830 etc. the mapping from high to low level > (e.g. payOut() vs. moveRightOrUp()) > is 1-to-1, but that is not so in some other games. E.g. in > 1835 the price gets down only > one square, independent of the number of shares sold. And in > 1 and 2.5 dimensional > stock markets the mapping will be even more different. > StockMarket would be responsible for this mapping. > * StockMarketTestServlet - will display the 1830 stock > market, and allow movements for 1 company > (I chose the PRR, starting at 67). Press the buttons to see > the effects. > > You'll need a servlet runner to play with this. I use Apache Tomcat. > The full class name is game.test.StockMarketTestServlet. > > In addition, StockChart has a main() method so that it can be > run stand-alone; > it displays the 1830 stock market but that's all yo can do on > the command line. > I run it with "java -classpath /projects/rails/18xx game.StockChart". > > Another nice-to-have would be a StockMarketTestApplet, but > maybe there are more UI-savvy > people around here who can make applets a lot faster than I could. > I would rather like to continue with including different companies > and to implement features for other games (ledge, > company-closing squares, game-end square etc.). > > Other included files are: > * 1830market.xml - an XML file that defines the StockChart, > which reads it at instantiation time. > Format is provisional, of course, but it's a start. > * 18xx.css - a stylesheet for the stockmarket. > * testservlet.properties - defines URL prefixes for the > servlet and the stylesheet. > > Of course this all just a proposal at this stage. > > One architectural question I already face now is whether or not > we will have one central XML definition file, or one per > class that needs to be initialized. > The former looks best, but poses the problem how to organise > parsing it. > I suppose we could have one class doing the SAX parse() call, > and have the primary > callback methods, which could, depending on its state, call > (static) methods in the classes > that need to be initialised by the XML. > > Erik. > > > |