Crates.io | ticket2ride |
lib.rs | ticket2ride |
version | 0.3.1 |
source | src |
created_at | 2021-10-28 14:14:22.908234 |
updated_at | 2021-11-07 20:00:24.074624 |
description | A small program to compute the theoretically largest score in ticket to ride Europe |
homepage | |
repository | https://github.com/ktsiligkiris/ticket2ride |
max_upload_size | |
id | 473582 |
size | 54,068 |
This project started as a mind exercise, when I asked myself what the largest theoretical score in this game could be. Before I started this, I read in a few places opinions about high score routes, but there was no evidence if these where the optimum solutions. So I told myself, this is a nice project to work on my programming skills in rust and in exploring algorithms for solving this.
This is the first attempt and no specific algorithmic logic is used, only brute force, basically.
The user, when executing the cli program, can provide the starting
city for the algorithm with the -c
or --city
option. If no city if
provided or if the city provided is non existent, then Edinburgh is
used by default.
The program execution consists of two steps. In the first step, all possible routes are explored, starting from the initial city. In the second step, all these possible routes are scored, and then the route with the highest score is found.
The correctness of the program is not certain. It seems to create valid routes and after fixing a logic bug, the score is correct, taking into account:
Also, I guess because of the use of HashMaps, the maximum number of routes computed each time differs. My reasoning is that because HashMaps are not ordered and each time the way that are stored in memory is kind of arbitrary, the computed routes differ also. Maybe there is some bug in my logic there that I need to check.
One final consideration is that all routes start from the initial city and no route is created where the initial city is in the middle of a route.
This that I could do in the future: