From: John A. T. <ja...@ja...> - 2006-07-07 20:29:08
|
Erik Vos wrote: >This looks good enough for 1830 and the like. >My only quick remark is that hopsleft is not checked for becoming zero. > >A more general algorithm should take into account the possibility >that certain junctions would not count against maxhops >(e.g. villages and ports in 18EU). In that case searching should >continue until hopsleft would become -1. > > It actually needs to be different than that, because different trains have different abilities: * plus-trains get either a fixed or unlimited number of towns that are counted separately from the main number * H-trains count hexes rather than stops * Halts in 1860 and G-trains running to mines in 1824 pay to the company treasury not the run value * H-trains can't run to off-board areas in 1844 * 4D-trains in 18Mex double cities but not towns, towns don't count against the train limit * Mountains/tunnels in 1844 have to keep track of when they are activated etc. So, more generally, I think the object that gets passed around has to know about the train type being used for the run and would also accumulate the value and other effects of the train operation. >I'm wary of bitmaps and would go for objects pointing to each other. >But that is more intuition than anything else. >Objects take more memory, but are we running short? > > I have done a lot of work in chess (and other games) endgame retrograde analysis. Bit vectors make the algorithms much cleaner, and I think there may be room to use something similar here. For example, given a set of positions which are won in n moves, to find the set of predecessors you simply say bv2=Predecessor(bv1). This could definitely be done for tracking connectivity for track laying and token placement, but I am not positive it is useful for the route building or not. It also makes copying the connectivity graph much easier -- deep copies of a cyclic graph are not trivial and take a lot of time compared to just copying a 2D array of bits. >In the below I will use the terminology I have used >so far in this project; I use "Station" for Junction >and will use "Junction" for the superclass of "Edge" and "Exit"; >and what people often call Station or Token or Garrison or Railhead >I call a "BaseToken", which will (in the future) be one >of the many subclasses of "Token". > >The tree will then, in my opinion, look like: > >Tile >| >+-- Station (value) >| | >| +-- Slot (location) <--> BaseToken <--> PublicCompany >| | >| +-- Exit ------ >| > Junction (superclass or interface) >+-- Edge (sidenr.) -- ^ ^ >| | | >+-- Track (gauge) <------+ | > <--------+ > >A Track connects two Junctions, either of which can be an Edge or an Exit. >Tiles obviously connect to each other via Edges. > > Ok. I used Junction as it is the terminology in TileDesigner and my re-implementation of it. >The <Tile> XML should specify all of the above >(except of course BaseToken & Company) > >Comparing this with the current Tiles.xml contents, >Slots and Exits would be added, and the location would >move from Station to Slot (where we need it for token placement). > >(BTW the current location values are my encoding of the longer >location descriptions as used in TileDesigner. I suppose we will >need some sort of polar coordinates instead). > >The structure per tile will be created when the XML is parsed, >and we will need to clone tiles of which the quantity is >1 >(this is not done yet for tiles; it is done for certificates). > > I would prefer to have one database of tile defintions, and then when the game is loaded the correct set (and upgrade paths) can be pulled in based on the game's tile manifest and orientation changes. Any cloning of the tile objects would take place that that point (although I wonder why the tile objects themselves need to be cloned -- why not just have a pointer to the tile and change the available count in the tile manifest? -- the design of the Tile object I have been porting from my perl code has no knowledge of its location, so that context is passed in much like a flyweight object). -- John A. Tamplin ja...@ja... 770/436-5387 HOME 4116 Manson Ave Smyrna, GA 30082-3723 |