Jump Calculations Jeff Zeitlin (27 Mar 2020 22:32 UTC)
Re: [TML] Jump Calculations Vareck Bostrom (28 Mar 2020 01:42 UTC)
Re: [TML] Jump Calculations Vareck Bostrom (28 Mar 2020 02:13 UTC)
Re: [TML] Jump Calculations Jeff Zeitlin (28 Mar 2020 19:16 UTC)
Re: [TML] Jump Calculations Vareck Bostrom (28 Mar 2020 19:26 UTC)
Re: [TML] Jump Calculations shadow@xxxxxx (28 Mar 2020 21:14 UTC)
Re: [TML] Jump Calculations Vareck Bostrom (28 Mar 2020 21:45 UTC)
Re: [TML] Jump Calculations Thomas RUX (29 Mar 2020 21:20 UTC)
Re: [TML] Jump Calculations Jeff Zeitlin (30 Mar 2020 22:13 UTC)
Re: [TML] Jump Calculations Thomas RUX (31 Mar 2020 02:37 UTC)
Re: [TML] Jump Calculations Kurt Feltenberger (31 Mar 2020 02:50 UTC)
Re: [TML] Jump Calculations Edward Anderson (31 Mar 2020 10:18 UTC)
Re: [TML] Jump Calculations Vareck Bostrom (31 Mar 2020 17:35 UTC)
Re: [TML] Jump Calculations Thomas RUX (31 Mar 2020 21:47 UTC)
Re: [TML] Jump Calculations Thomas RUX (31 Mar 2020 21:59 UTC)
Re: [TML] Jump Calculations Ewan (01 Apr 2020 13:04 UTC)
Re: [TML] Jump Calculations Thomas Jones-Low (13 Apr 2020 01:35 UTC)
Re: [TML] Jump Calculations kaladorn@xxxxxx (13 Apr 2020 02:49 UTC)
Plague Thomas RUX (31 Mar 2020 21:22 UTC)
Re: [TML] Plague Jeff Zeitlin (03 Apr 2020 10:23 UTC)
Re: [TML] Plague shadow@xxxxxx (03 Apr 2020 18:41 UTC)
Re: [TML] Plague Timothy Collinson (03 Apr 2020 19:42 UTC)
Re: [TML] Plague Timothy Collinson (03 Apr 2020 20:58 UTC)
Re: [TML] Plague Timothy Collinson (04 Apr 2020 07:01 UTC)
Re: [TML] Plague Thomas Jones-Low (05 Apr 2020 12:51 UTC)
Re: [TML] Plague Bruce Johnson (03 Apr 2020 20:40 UTC)
Re: [TML] Plague kaladorn@xxxxxx (13 Apr 2020 16:53 UTC)
Re: [TML] Plague Kenneth Barns (14 Apr 2020 01:07 UTC)
Re: [TML] Plague kaladorn@xxxxxx (14 Apr 2020 02:44 UTC)
Re: [TML] Plague Kenneth Barns (14 Apr 2020 08:08 UTC)
Re: [TML] Plague kaladorn@xxxxxx (15 Apr 2020 01:14 UTC)
Re: [TML] Plague shadow@xxxxxx (15 Apr 2020 01:13 UTC)
Re: [TML] Plague kaladorn@xxxxxx (15 Apr 2020 01:18 UTC)
Re: [TML] Plague Thomas RUX (15 Apr 2020 02:20 UTC)
Re: [TML] Jump Calculations Christopher Sean Hilton (12 Apr 2020 02:51 UTC)
Re: [TML] Jump Calculations Christopher Hilton (12 Apr 2020 12:00 UTC)
Re: [TML] Jump Calculations kaladorn@xxxxxx (12 Apr 2020 23:12 UTC)

Re: [TML] Jump Calculations Christopher Hilton 12 Apr 2020 12:00 UTC

On Apr 11, 2020, at 10:51 PM, Christopher Sean Hilton <xxxxxx@vindaloo.com> wrote:
>
> On Fri, Mar 27, 2020 at 06:32:37PM -0400, Jeff Zeitlin wrote:
>> Given a standard Traveller subsector, with coordinates 0101 to 0810,
>> alternate columns staggered, what's the formula/algorithm to calculate the
>> jump distance between two hexes?
>>
>
> To start, there is a wealth of information on hex grids here:
>
> * [Hexagonal Grids](https://www.redblobgames.com/grids/hexagons/)
>
> Your question is best answered by the sections on Coordinate systems
> and distances:
>
> * [Hex Coordinate systems](https://www.redblobgames.com/grids/hexagons/#coordinates)
> * [Hex Distances](https://www.redblobgames.com/grids/hexagons/#distances)
>
> ----------------------------------------
>
> If you read the sections it will give you the algorithm. Here's some
> python that implements it.
>
> ```
> class Hex(object):
>
>    def __init__(self, hex_label):
>        self.hex_label = hex_label
>
>        ## Break a four digit hex label into it's x and y components
>
>        self.x, self.y = divmod(hex_label, 100)
>
>        ## Calculate an alternate (x, y) in this system two hexes
>        ## with the same y value will always be in a row.
>
>        self.alt_x = self.x
>        self.alt_y = self.y - (self.x // 2)
>

There’s a of-by-one bug here: The above line should read:

    `self.alt_y = self.y - ((self.x - 1) // 2)`

[ …snip… ]

Chris

      __o          "All I was trying to do was get home from work."
    _`\<,_           -Rosa Parks
___(*)/_(*)____.___o____..___..o...________ooO..._____________________
Christopher Sean Hilton                    [chris/at/vindaloo/dot/com]