Miscellaneous items
This page collects smaller to-do items for each crate, the test cases, and the examples.
n18io
Nothing.
n18map
-
n18map::descr::update_map: return aResult. -
n18map::descr117-119: wantMapto support placing tokens by name, similar to placing tiles? -
n18map::map:ParseHexAddressError, indicate in the returned error when we find an odd/even value instead of a required even/odd value. -
We may want to allow
Gameobjects to useMap::replace_tileto replace tiles that are not otherwise replaceable. -
Modify
Map::prev_col,Map::next_col,Map::prev_row, andMap::next_rowto either-
Return
Option<HexAddress>values and returnNoneif the previous/next address isn’t a valid hex; or -
Keep decreasing/increasing the column/row number until a valid address is found.
-
-
Make
HexAddresssupport more than 26 columns when converting to/from string coordinates.
n18route
-
n18route::builder: note in the doc strings that the “to_“ prefix is not a type conversion; these connectivity functions. -
n18route::comb: odd that splitting at not-half-way gives worse performance:#![allow(unused)] fn main() { // let range = (self.ix0_max - self.current_ix) as f64; // let denom = 2.0_f64.powf(1.0 / self.max_len as f64); // let delta = (range / denom).round() as usize; // let split_at = self.current_ix + delta; } -
n18route::path::Path:- add an
append(other: Path)method toPath?
- add an
-
n18route::path: distinguish betweenPath(which defines track segments, hex faces, and cities that a train passes through) andRoute(which defines the visits that the train makes). -
n18route::search:-
use
rayonto iterate overconnections.iter()in parallel? -
use
rayonto iterate overpaths.iter().enumerate()in parallel? -
depth_first_search(): should we allow starting at a dit? If not, store the starting city_ix in the context? -
Adjacent red hexes are considered the same location and cannot be visited multiple times, so we should probably have adjacent red tiles contain a single city with track that connects to all of the other adjacent red tiles ... or have
Tiledefine this instead (e.g.,tile.is_offboard())?Further on,
let off_board = tile_colour = ..., shouldTiledefine this instead? -
n18route::search::tests: also modify the map so thatpaths_fromandpaths_throughreturn different revenues, and we can check that they’re each correct.
-
n18tile
-
n18tile::city: renameTokenstoTokenSpacesor something similar. -
n18tile::city:City::translate_coords()uses custom adjustments forHexPosition::FaceandHexPosition::Corner, andCity::delta_coords()duplicates some ofHexPosition::to_coord().- Remove the custom position adjustments?
- Define
Delta::coord(hex: &Hex, from: Coord) -> Coordand use this inHexPosition::to_coord()andCity::translate_coords()?
-
n18tile::city: add support for fine-grained rotation of cities; see the starting map tile for Kouchi in 1889 for an example. -
Replace the
boolfield inn18tile::label::PhaseRevenueandn18tile::label::PhaseRevenueVertwith a new enum type that has variantsNormalandEmphasise? -
n18tile::tile::Tile:- Break out the layer calculations into a separate struct, similar to
connection::Connections? - Expose functions for drawing layers for integration tests?
pub fn tracks_in_layer(&self, layer) -> ?Vec?pub fn cities_in_layer(&self, layer) -> ?Vec?
- Mark track segments on red (and blue) tiles as terminal?
- Involves adding a
pub terminal: boolfield toTrack, with a default value offalse, and adding a methodmark_as_terminal()
- Involves adding a
- Break out the layer calculations into a separate struct, similar to
-
n18tile::track::Track: define a privatedit_direction(&self, hex: &Hex) -> Option<Coord>method?-
The
Tracktype really needs an internaldit_coord()method, it would replace a lot of duplicated code. -
Verify that
Track::dit_coord()actually agrees with the dit location! -
Make
track::CoordsuseTrack::get_coord()for iteration, so that there’s only one piece of code that calculates track coordinates.
-
n18token
-
n18token:Token: it would be nice if each token owned its name, but then Token cannot implement Copy ...- This should be in the type and/or module documentation.
-
n18token:Tokens: implementIntoIteratorforItem = (String, Token)... be we need to specify the exactIteratortype, so we’d have to make our own struct that implementsIterator.
n18ui
-
Add a new state that draws all of the track segments, etc, on off-board tiles, rather than only drawing the track segments on the off-board tile faces. Rather than adding a new flag to
Tile, add a newTilemethod that draws the tile and ignores the off-board special case, and add a newn18brush::draw_tiles()equivalent that calls thisTilemethod. -
Do not allow the user to place tokens on off-board tiles that have hidden revenue centres (i.e., tiles for which
tile.offboard_faces().is_some()istrue).
Test cases
-
tests/connection_bonus: also try requiring only one of the skipped dits, adding to_any options that are/are not on the path, including Toronto and Montreal, and so on. -
n18catalogue: test tile connections for most (all?) predefined tiles. -
n18hex,n18tile,n18map: write tests cases for coordinates, tile layout, and map connectivity forOrientation::PointedTop.
n18game
Learn from the experience of implementing 1861 and 1867 and provide a variety of helper methods for implementing other games.
Consider dividing n18game into sub-modules:
-
tiles(catalogue)- Provide a TileBuilder type
.track(&mut self, Track).tracks(&mut self, IntoIterator<Item=Track>).city(&mut self, City).cities(&mut self, IntoIterator<Item=City>).onboard_faces(&mut self, IntoIterator<Item=HexFace>).build(&hex, colour, name: IntoString)
- Collect key game information in a single place
- i.e., special tiles AND their locations / initial_state.
- Provide a TileBuilder type
-
addrs(define hex addresses and constants for each city)- Make each town and city’s location a
static constvalue? - Simplify defining the full range of map hexes
- Allow
[A-Z]+[0-9]+but must also support negative rows and columns.
- Allow
- Make each town and city’s location a
-
map(initial state, phases) -
tokensand/orcompany- May want to have tokens that are not part of a company for, e.g., national railways.
n18catalogue
- Should
Kind::build()also take an18hex::Orientationargument, so that the positioning of tile elements (such as labels) can depend on the hex orientation?