Expand description
This project contains data structures for representing the ticket to ride Europe edition game and some functions for computing possible routes and their respective scores.
Here I provide some enumerations and hash maps that are required for representing the ticket to ride Europe game in my code. The functions for computing routes and scores are included in the respective modules.
Modules§
- routing
- The routing module contains all functions relative with computing the route on the board network of cities.
- scoring
- The scoring module contains all the functions that are needed for computing the score of a route on the board of ticket to ride.
Structs§
- City
Iter - Ticket
- The struct for representing a game ticket which includes the departure city, the arrival city and the value of the ticket when it is satisfied. This struct is used for both regular tickets and the six big tickets.
Enums§
- City
- All available cities of the game are included into this handy enumeration, so that my code is more clear. The cities are not entered with any particular order, I just started from Edinburgh and traversed the map gradually most of the times randomly.
Functions§
- create_
network - This function creates the game network. This is a Hash map of which the keys are the cities of the game and the value of each key is a Hash map of the cities that the key city can connect with and the number of trains that are needed to connect to that city.
- get_
big_ tickets - This function returns a vector with the 6 big tickets of the game. Differentiating between big tickets and small tickets is not relevant for computing the max theoretical score but still it’s nice to have it separately, for future stuff to come.
- get_
tickets - This returns a vector with the regular tickets of the game.
- max_key
- This is a helper function the finds the maximum value in a HashMap and returns the key of that maximum value. This is basically used to find the path with the largest score in the possible paths computed from a specific starting city.