# Combat Corner Case - arrive same time from same distance?

So in a recent “duel” game with mirrored galaxies (which just ROCK!), there was a middle star (actually two of 'em) that was reachable by both players at the same time … so how does combat go when an unoccupied star is reached by two players are the same time who have traveled the same distance?

The Triton Codex says the following:
If two players approach an unoccupied star and are due to arrive at the same
time, the ship that has traveled the shortest distance will claim the star first
and will receive the defenders bonus

But I don’t see anything that says what happens if they travel the same distance.

Just to be clear, the travel time was 9 hours and 2.7LY distance for both - really was the same!
There was a nearby case where travel time was 9 hours but 2.7/2.9LY … I assume the player coming the shorter distance (but same time) would get defensive bonus there.

The new Chain Ruler is a nice new feature implemented by @dakotahawkins on 2014 JUL 14 .

The old ruler would measure distances to two decimal places, but the new Chain Ruler only measures to one decimal place.

I work around that by measuring any single path 10 times, which multiplies that distance, thus shifting the distance by one decimal place to the left. Now I can see one extra hidden digit of accuracy.

Because of the way computers do floating point math, there will usually be some rounding errors if you acquire enough decimal places, but these can be too tiny to be read from the Chain Ruler.

Only a fanatic would measure a single path 100 times for the next smaller digit of accuracy, and then 1000 times for the next smaller one, and 10000 for the next digit, and powers of 10 more for each one additional digit, and more and more . . .

I could only imagine having none of the players the defender bonus in this case.
If its implemented like this, no idea.

The carrier that arrives first becomes defender. So that is measured by flight distance remaining.

Ahhhhh … very, very clever xjhdexter!

The game in question is over, but is still around … so I went back and measured it ten times … and the distances (x10) were 26.9 and 27.0 LY … and 28.5 and 29.0 LY. So presumably, the underlying code is accurate to the extra digits and would reward the player who flew a smidget less distance who gets the defensive bonus.

I still kinda wonder how it’s handled if the distances are exactly the same - does seem like NO defender bonus would apply … or maybe if more than two players arrives at the same time from exactly the same distance, a wormhole is created!

I can not speak for Jay, but I imagine that in the code, a typical programmer would sort all carriers by remaining distance yet to be traveled, then shortest distance arrives first as potential defender unless planet was already claimed. In a square grid map, then it is very easy to have even equal distances. But in a random scatter map, floating point measurements can have wild decimals. The Pythagorean theorem uses square roots, which can sometimes come out a slight smidgen off depending on the internal algorithms, which varies from servers to programming languages. So IDK. It can be a coin toss. Six one way, half a dozen the other.

This is good enough for a game. Jay is not trying to find the Higgs boson with a super collider.
( Although the dolphins in the Hitchhiker’s Guide may have another opinion ! HA HA !! )

At least you know that 2.85 LY is not actually 2.849, because it would have to be 2.8501 or more than 2.85000000 to read as 2.9 LY. HA HA !

Curiously . . . I am currently in a game with 6 tick jumps. I have measured traveled distances of carriers away from the departure star, and sometimes the Chain Ruler will report 7 ticks. I am not complaining. This is just a demonstration of the anomaly of the inexact nature of digital computations for floating point math. I doubt this can be corrected to anyone’s satisfaction, simply because of the way computers work. I just enjoy the game anyways. I have not noticed any miscalculations for future travel times remaining. ( Shhhhh !!! Jay may have fixed it this way ? To ensure that future events are always processed correctly ? And that is what is most important anyways ! )

I am happy that we do not have to worry about more serious bugs, like this blast from the past !

HA HA !!

All good points xjhdexter …I remember you making some similar excellent points in the anomaly in the Madness game where a star was reachable with Hyper1, but required Scan3 to see

• still think that was a coding bug probably due to distance calculations being done two different ways rather than via a common routine.

FYI that the Codex says “shortest distance traveled” … so sorting by remaining distance would technically be wrong. Say Player #3 occupies a star with a Warp Gate on it. Player #1 is 2.30 LY away (traveling at normal 0.33LY/tick) and Player #2 is 6.01LY away but traveling at WG speeds of 1.0LY/tick - i.e. travel time is 7 hours for both at the time they launch.

At tick #6, the Player #3 abandons the star (nullifying the WG) and at that point, Player #1 is 0.30 LY away while Player #2 is 0.01LY away … but Player #1 was a shorter distance traveled and should get defensive bonus.

Yea, I realize this is an incredibly rare (and unrealistic) corner case … but does illustrate how underlying algorithms need to accurately reflect documentation … although yea, it’s just a game … not quite as mission critical as the maiden flight of the Ariane 5 rocket - D’OH!

P.S. Not to date myself, but as an old IT guy, I remember when the Pentium FDIV bug hit.

I may be misunderstanding, but I believe it was the carrier which travelled the shortest distance during the last tick of travel which arrives first and gains defender bonus, not the ship which travelled the shortest distance from its starting point.

Looking back at the help file I don’t see it saying that, so I can’t remember if it has changed or simply isn’t specific enough. It’s been a while since it’s come up for me to be honest.