I attempt to cache some constants to improve performance, and try out some board games such as Sequence and Clippers.

## Caching constants

Some long waited-for cleaning has been occurring today with the air performance code. I’ve been removing magic numbers from code because they are just rounded off from more accurate values. But, removing them results in more complex code, which may result in slow downs when updating graphs and charts, so caching those more accurate values as constants means that they don’t need to be calculated all over again. So instead of just using an approximation of 41.8 for the conversion factor

return 41.8 * Math.pow(BHP / Math.pow(prop, 2), 1 / 3);

A more accurate version of 41.8 is: (33000×60^{2})/(0.002377×(5280/60)^{3}) but I don’t want to have to calculate that out all the time, so it’s calculated just once instead

var constant = constants.propellerAirspeed, to_horsepower, per_hour, air_density, fpm, density_fpm; if (!constant) { to_horsepower = constants.convert.to_horsepower; per_hour = to_horsepower * 60 * 60; air_density = airDensity(altitude_ft); fpm = 5280 / 60; density_fpm = air_density * Math.pow(fpm, 3); constant = Math.pow(per_hour / density_fpm, 1 / 3); constants.propellerAirspeed = constant; } return constant * Math.pow(bhp / (prop * prop), 1 / 3);

This lets us cache the constant, so that it doesn’t have to be calculated all over again.

## Board games

At Lisa & Peter’s tonight we had a go at Sequence, The Resistance, and Clippers.

### Sequence

Sequence (1982) is a board and card game where board shows a small version of all the cards from two decks in a 10 by 10 pattern. The aim of the game is to place markers on the board so that you end up with five markers in a row.

Each player gets a hand of five random cards from the deck. On your turn you discard one of your cards, place your marker on that card on the board (there are two of each card), and draw another card.

Jacks are not on the board, but are wild cards instead. Half of the jacks are one-eyed, allowing you to remove someone’s marker from the board too.

### The Resistance

The game of The Resistance (2009) that we played tonight was with 8 players, and ended very quickly. With so many players there were 3 spies in our group, and the first mission involves 3 people instead of the usual 2. This gave a spy a good opportunity to fail the first mission right away, and no matter what the resistance did, other spies were able to fail the other missions too, resulting in a win for the spies.

If there is some kind of strategy that may work when there are more than 2 spies, it would be good to know.

### Clippers

Clippers (2002) is a board game where players own trade settlements on Pacific islands, and need to attempt to get shipping trade routes established to their islands in order to score points. Each round, there are four phases of play that the players take turns performing:

- Placing a trade settlement, or buying an option card that lets you play more than one stick on a route at a time
- 1st phase of placing sticks
- 2nd phase of placing sticks
- Return any option cards

When placing sticks on the board, you are normally only allowed to place one stick, which makes things tricky because a route cannot be left incomplete during your phase, and most islands require 2 or more sticks to complete a route. You are rewarded 2 gold when creating the first route to an island, and this is where the option cards come in to play.

Option cards can be purchased, such as one that let you play 2 sticks at a time and double your bonus money, or 3 sticks at a time with no bonus. With these option cards you can then more easily complete routes, but it’s a fine balance between completing routes to where you want them to go, and placing trade settlements that score you winning points before other players have placed them too.

It’s an interestingly themed game, but Ticket to Ride would still be first pick as my preferred type of route-completion game.