1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! # Overview
//!
//! This module solves the problem of finding the set of routes that can be
//! run by a company to yield the highest possible revenue.
//!
//! For example, the following function can find the best routes on a map for
//! a specific company (identified here by their `Token`) that owns one or
//! more trains, given (game-specific) [rules](ConflictRule) about which
//! elements may be reused by a single route (`conflict_rule`) and which
//! elements may be shared by multiple routes (`route_conflict_rule`):
//!
//! ```rust
//! use n18route::{paths_for_token, Bonus, Criteria, ConflictRule, Trains, Routes};
//! use n18map::Map;
//! use n18token::Token;
//!
//! fn find_best_routes(map: &Map, token: Token, trains: Trains,
//! bonuses: Vec<Bonus>) -> Routes {
//! // Find all of the paths that the trains could operate.
//! let criteria = Criteria {
//! token,
//! path_limit: trains.path_limit(),
//! // NOTE: game-specific rule.
//! conflict_rule: ConflictRule::TrackOrCityHex,
//! // NOTE: game-specific rule.
//! route_conflict_rule: ConflictRule::TrackOnly,
//! };
//! let paths = paths_for_token(&map, &criteria);
//!
//! // Return the best routes out of the available paths.
//! trains
//! .select_routes(paths, bonuses)
//! .expect("Could not find an optimal set of routes")
//! }
//! ```
//!
//! See the [route-finding documentation](crate::doc) for details.
pub use ;
pub use ;
pub use ;
pub use ;
pub use Bonus;