Squares, hexagons and distance

Most traditional board games use squares to segregate space.

Square terrain

Space is divided evenly. Lines are easy to draw. Everything is structured. Bliss.

Except that when you need to move to a diagonal square, you need to move 2 squares instead of √2 squares. Wait, a non-integer movement? That cannot be tracked!

Dungeons & Dragons 4th Edition (a tabletop RPG with physical positional tracking) state that a diagonal square movement costs the same as a perpendicular square movement. Meaning you just move 1 square to reach that diagonal square. This also has its problems.

For example, there’s a concept of push in D&D, where as long as the target being pushed is moved further away, it counts as a push. Bringing us to this situation:

Perpendicular push movement

I talked about this briefly on my other blog, but didn’t go into the math details. So the blue dot is you, the red dot is the enemy, and the brown dot is where the enemy is pushed to.

The distance between you and the enemy is (do the Pythagoras thing) 2√2 (approx 2.8284). The distance between you and the final position of the enemy is √10 (approx 3.1623). Sure √10 is greater than 2√2, so mathematically speaking, the enemy is moving away from you. But common sense is telling me otherwise, because the direction of the push emanates from you.

Anyway, to combat the shortcomings of the square terrain, there’s the hexagonal terrain.

Hexagonal terrain

Under this division of space, all adjacent spots are equidistant to your position. Well, it still has its problems. You still need 2 hexagons of movement to reach the first hexagon directly above you.

Hexagonal movement

So what’s the actual cost of movement? Let’s look at this extracted diagram:

Hexagonal movement calculation

Let h be half of the actual distance. Doing the Pythagoras thing again, we have
1^2 = h^2 + (1/2)^2
=> 1 = h^2 + 1/4
=> h^2 = 3/4
=> h = √3/2 (h is positive)

Therefore, the actual distance is 2h which is √3 (approx 1.7321). Not quite 2 hexagons, is it?

This is part of the reason why, when games are created on computers, that these limitations disappear. Because computers can do the distance calculations and tracking. You can move in any direction, for any amount of units of movement, as long as you do not hit anything.

And that is called collision detection.

It’s not about number of urinals, it’s about the space they are in

There’s a post on the packing efficiency of urinals on XKCD. In summary, assuming that

  • first male to use a urinal picks a corner urinal
  • a male picks his urinal that’s furthest away from all other urinals in use
  • a male will keep at least 1 urinal between him and another male

then the best number of urinals in a row are of the form 2^k + 1, where k=1, 2, 3, …

Or if you’re not in the mood for math, 3, 5, 9, 17 and so on. I’m not listing more because, WHAT KIND OF ARCHITECT BUILDS 17 URINALS IN A ROW!?! But I digress…

What I want to emphasise is that the last assumption is the overriding one. The first 2 assumptions are corollaries of the third. It’s the buffer urinal that the self-conscious male is worried about.

Let’s look at the trivial case of 2 urinals. Based on the assumptions, there will only ever be 1 urinal in use at any one time. In effect, it’s no better than just putting 1 urinal. So why build 2 urinals?

Bonus thought experiment: One of the 2 urinals is probably used more often than the other. Based on reasons such as it’s the one furthest from the main toilet door, it’s the one most hidden from view, it’s the cleaner (for whatever reason).

However, if you build 2 urinals with 1 urinal’s space in between them, then both are more likely to be used at the same time when there are at least 2 males needing to release their liquid waste. Based on that specification, a 5-urinal-in-a-row setup is no better than a 3-urinal-with-1-urinal-space-in-between-them setup.

It’s not about the number of urinals in a row. It’s about the available space they were built in.

And I think I’m done talking about urinals for the rest of my life… (I counted 22 uses).