From: Stefan F. <ste...@we...> - 2014-09-10 15:27:06
|
Follow up with details on 1860/1862 stockmarket: My understanding of the stockmarket of 1860/1862 is that it resembles a hexagonal stock market with pointy topped hexagons (or East/West orientation as it is called in Rails for 18xx maps). It has two rows of hexagons and wraps around at the upper/lower edge. In the following I refer to the definitions used by http://www.redblobgames.com/grids/hexagons/. In axial coordinates we have the following: * The first coordinate is identical to the column number of each row, if we assign the bankrupt field to the first column. * The second coordinate is not vertical, but 60 degrees going from NW to SE. It is identical to the row number (0 and 1). Using this for the 1862 stock market: Bankrupt hex has coordinates (0,0) then 7 is (0,1), followed by 14 (1,0), 20 (1,1), 26 (2,0), 31 (2,1) etc. * Wrap around at the bottom implies that we jump from a "virtual" coordinate (x,2) to coordinate (x+1,0) * Wrap around at the top implies that we jump from a "virtual" coordinate (x,-1) to coordinate (x-1,1). Selling shares implies a transition of (-1, +1): * From 26 (2,0) to 20 (1,1) * From 20 (1,1) to virtual (0,2) => wrap around edges => 14 (1,0) * From 14 (1,0) to 7 (0,1) * From 7 (0,1) to virtual (-1,2) => wrap => bankrupt (0,0) Paying dividends is simply increasing the first coordinate according to the number of spaces moved. A more complex version of a hexagonal stockmarket is used in 1854. Stefan On 09/08/2014 06:38 PM, Stefan Frey wrote: > Mike: > below you find a proposal how to restructure StockMarket. This is an > example how I would like to change other components of Rails in the > longer run. > > Please feel free to comment. > > I will write a mail on 1862/1860 stock market specifics later. > > Stefan > > Suggestions for a component structure. Example: Stockmarket > > Currently the core parts of logic, data and creation for the Stockmarket > is combined in one class: Stockmarket. > > A) Separation of Data and Logic > > The data parts of Stockmarket should be moved to a separate class (e.g. > xxxMarketModel). > Possible classes depend on the StockMarket: > e.g. RectangularMarketModel, HexagonalMarketModel, LinearMarketModel > > The logic part replaces the existing StockMarket class and contains > method called from Rails that operate on the > StockMarket, e.g. payout, withhold, sharesSold, etc. > > Most likely there will be some default Markets, like RectangularMarket, > HexagonalMarket or LinearMarket, but more > specialized are possible. > > Customization should be possible in two ways: > > i) Internal configuration due to xml settings. > > ii) Implementing StrategyInterfaces that adjust part of the internal > working of the default market. > E.g. there could be a SoldOutStrategy interface, that allows to change > how the market behaves if > shares are sold out after a stock round. > > B) Move Creation to a Builder/Factory class (StockMarketFactory) > > Creation of the StockMarket is then done by a separate class, that wires > together the different classes according > of the needs of the specific 18xx. > > I prefer to use code to wire together Java elements, so no class names > should appear in xml files. This allows easier refactoring > and code optimizations. > > C) Roadmap > > I offer to create the basic components for 1830 according to the > structure outlined above. Then other > stockmarkets can be modelled along these lines. > > On 09/07/2014 09:18 AM, Michael Alexander wrote: >> Yes, it is extremely similar to 1860. It might be that the only >> difference is that the one in 1862 is longer at the high end. >> >> No hurry on the response, there are plenty of other things to do. >> >> On Sun, Sep 7, 2014 at 3:09 AM, Stefan Frey <ste...@we... >> <mailto:ste...@we...>> wrote: >> >> Mike: >> I will come up with a more detailed answer later today. >> I have not played 1862 yet, however from a short glance, it seems that >> the stock market is similar to the one of 1860. >> I would not recommend that path, instead please wait on my thoughts, if >> you do not mind ;-) >> Stefan >> >> On 09/07/2014 05:42 AM, Michael Alexander wrote: >> > And now that I'm looking at the stock market... >> > >> > I don't think I can use much of the existing Stock Market class for >> > it. It just won't fit in a rectangle. I could make a new "Stock >> > Market" class for this one and make the .xml file specify which one to >> > use. Should I take that direction? >> > >> > Mike >> > >> > >> > On Sat, Sep 6, 2014 at 8:54 PM, Michael Alexander >> > <out...@gm... <mailto:out...@gm...> >> <mailto:out...@gm... <mailto:out...@gm...>>> >> wrote: >> > >> > I've pushed up my changes - I think I did it correctly, please let >> > me know if I messed something up. >> > >> > I have the Parliament Round mostly working. My next step is to >> > work on the stock market. >> > >> > >> > On Fri, Sep 5, 2014 at 2:46 AM, Stefan Frey <ste...@we... <mailto:ste...@we...> >> > <mailto:ste...@we... <mailto:ste...@we...>>> wrote: >> > >> > I will delay for a further day, as I will only return on >> > Saturday. Change of plans. ;-) >> > >> > >> > >> > >> > Michael Alexander <out...@gm... <mailto:out...@gm...> >> > <mailto:out...@gm... >> <mailto:out...@gm...>>>schrieb: >> > >> > I unfortunately had something come up. Don't wait for me. >> > >> > >> > On Thu, Sep 4, 2014 at 1:03 PM, Michael >> > Alexander<out...@gm... <mailto:out...@gm...> >> > <mailto:out...@gm... <mailto:out...@gm...>>> wrote: >> > >> > I can get it to a state where I can do that tonight. >> > Thanks for the heads up. >> > >> > >> > On Thu, Sep 4, 2014 at 12:56 PM, Stefan >> > Frey<ste...@we... >> <mailto:ste...@we...> <mailto:ste...@we... >> <mailto:ste...@we...>>> >> > wrote: >> > >> > Martin & Alexander: >> > I have now rewritten a lot of the tile and token >> > lay UI code and intend >> > a new alpha tomorrow end-of-day. >> > So if you would like to merge some code into >> > rails_2_develop, there is >> > some time left to do so. >> > Good coding, >> > Stefan >> > >> > ------------------------------------------------------------------------------ >> > Slashdot TV. >> > Video for Nerds. Stuff that matters. >> >http://tv.slashdot.org/ >> > _______________________________________________ >> > Rails-devel mailing list >> >Rai...@li... >> <mailto:Rai...@li...> >> > <mailto:Rai...@li... >> <mailto:Rai...@li...>> >> >https://lists.sourceforge.net/lists/listinfo/rails-devel >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Slashdot TV. Video for Nerds. Stuff that >> > matters.http://tv.slashdot.org/_______________________________________________ >> > <http://tv.slashdot.org/_______________________________________________> >> > Rails-devel mailing lis...@li... >> <mailto:Rai...@li...> >> > <mailto:Rai...@li... >> <mailto:Rai...@li...>>https://lists.sourceforge.net/lists/listinfo/rails-devel >> > <https://lists.sourceforge.net/lists/listinfo/rails-devel> >> > >> > >> > ------------------------------------------------------------------------------ >> > Slashdot TV. >> > Video for Nerds. Stuff that matters. >> >http://tv.slashdot.org/ >> > _______________________________________________ >> > Rails-devel mailing list >> >Rai...@li... >> <mailto:Rai...@li...> >> > <mailto:Rai...@li... >> <mailto:Rai...@li...>> >> >https://lists.sourceforge.net/lists/listinfo/rails-devel >> > >> > >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Slashdot TV. >> > Video for Nerds. Stuff that matters. >> >http://tv.slashdot.org/ >> > >> > >> > _______________________________________________ >> > Rails-devel mailing list >> >Rai...@li... >> <mailto:Rai...@li...> >> >https://lists.sourceforge.net/lists/listinfo/rails-devel >> >> >> ------------------------------------------------------------------------------ >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> <mailto:Rai...@li...> >> https://lists.sourceforge.net/lists/listinfo/rails-devel >> >> >> >> >> ------------------------------------------------------------------------------ >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> >> >> >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel >> > > ------------------------------------------------------------------------------ > Want excitement? > Manually upgrade your production database. > When you want reliability, choose Perforce > Perforce version control. Predictably reliable. > http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |