From: Erik V. <eri...@hc...> - 2005-05-12 22:56:17
|
I have committed a whole bunch of changes, mainly in connection with the implementation of StartRound_1830, a class that implements the main part of an 1830-like private buying-and-bidding round. The single-private auction, where two or more players are bidding or passing for one private, is not yet implemented (currently, the highest initial bidder gets the private). Auctioning may become a separate Round subclass, but I'm not sure yet. Also implemented are the Start packets - a separate section in CompanyManager.xml. For 1830-like games that may look like overkill, but we will need that for 1835-like games. (The base prices are now defined twice, only one of these will be retained). The "free" PRR and B&O shares (for 1830) come with the privates, and the B&O start price must be set on buying the related private. The general procedure to be followed by the UI is like; forever { Round currentRound = GameManager.getCurrentRound(); if (currentRound instanceof StartRound) { int step = ((StartRound)currentRound).nextStep(); if (step == StartRound.BID_OR_BUY) { // set up UI for a bid/buy action } else if step == StartRound.SET_PRICE) { // set up UI for setting a start price (i.e. B&O) } } else if (currentRound instanceof StockRound) { // Set up UI for the next stock round action } else if (currentRound instanceof OperatingRound) { int step = ((OperatingRound)currentRound).nextStep(); if (step == OperatingRound.LAY_TRACK) { // set up UI for track laying. // Currently only the cash spent can be processed. } else ..... } // process player action, by calling currentRound methods, // depending on the currentRound instance and the value of step. } Please note, that processing player actions may change the result of GameManager.getCurrentRound(), so it is important to call getCurrentRound() between a processing player action and setting up the UI for the next action. Round switching is done by the various Round classes in cooperation with GameManager. BTW GameManager is currently a curious mix of static and non-static methods. I'm not yet sure which way it will go. Maybe we will need different GameManager classes. There is still much to clean up and refine, but I think it was time to get some clarity on how the View/Model (i.e. UI/Round) interfaces could look like. test.GameTestServlet works, and may provide code examples. I will shortly publish some new HTML output examples. There is a lot more to tell, but for now this should do (and it's very late). Erik. |