Ticket to Ride Calculator

Ticket to Ride is a simple yet surprisingly enjoyable board game, easily picked up by pre-teen family members—and your friends with wine glass firmly in hand. I’m not much of a gamer myself, so I can’t speak to the game’s relative merits or strategic weaknesses. But I’ve played it a few times now and a) scoring is by far the most complicated part of the whole exercise (so many trains, so many cards!*); and b) this problem is a good excuse to practice a little spreadsheet coding. 

The main story is that I’ve built a calculator to tally up the points after the last train has been laid. I find it handy for the purposes of the game, but the model is useful any time you want a spreadsheet to automatically inform you of ranked results (who came first, who came second, etc).
You can download a copy--built in Mac Numbers--here:
Ticket to Ride Calculator
Ticket to Ride Calculator.numbers
Compressed Archive in ZIP Format 161.6 KB


The product looks like this:


The basics are straightforward: just a column for each player, with cells referenced to the points awarded for each train of a given length. Additional rows for each completed (and uncompleted) route follow, with the totals summed at the bottom. 
So far, so simple. What takes a bit of thought, however, is coding the final rankings. I find the easiest way here is to assign a rank to each score in a separate line, using the following code**:
(RANK, thisvalue, allvalues)
You can then turn the ranking row plus your player IDs into a cell that spits out the winner:
(INDEX, playerIDrange, (MATCH, 1, rankrange))
There’s nothing magical here, but spreadsheet coding isn’t always the most intuitive. It’s nice having a headstart on the syntax. 

Happy riding!



*It’s not like Settlers of Catan where you just hit 10 points and BANG, you’re done.


**Note that this code applies to Mac Numbers, but I find the two operate according to essentially the same rules. 


Write a comment

Comments: 0