Closed exp111 closed 1 month ago
Describe the bug The spiral traverser does not work as expected. Lets take the example from the docs:
const Hex = defineHex({ dimensions: 30 }); const grid = new Grid(Hex, rectangle({ width: 5, height: 5 })); const spiralTraverser = spiral( { start: [0, 2], radius: 1 }); for (let h of grid.traverse(spiralTraverser)) { console.log(`col: ${h.col}, row: ${h.row}`); }
I'd expect it to print out the hexes in this order:
However it prints out:
col: 1, row: 2 col: 1, row: 1 col: 2, row: 2 col: 1, row: 3 col: 0, row: 3 col: 0, row: 2 col: 0, row: 1
Meaning it made a spiral with its center at 1,2. If I start it at 1,2 it does a spiral at 2,2. The offset isnt always one as on a 10x10 grid with a start at 1,7 it will do a spiral at 4,7
Environment (please complete the following information):
Screenshots 0,2 to 1,2 offset visualized:
1,7 to 4,7 visualized:
Okay yea I got it. The HexCoordiantes [0,2] aren't {col: 0, row: 2} but {q: 0, r: 2}.
[0,2]
{col: 0, row: 2}
{q: 0, r: 2}
Sorry for answering so late, but good that you figured it out yourself 👍
Pretty textures btw.
Describe the bug The spiral traverser does not work as expected. Lets take the example from the docs:
I'd expect it to print out the hexes in this order:
However it prints out:
Meaning it made a spiral with its center at 1,2. If I start it at 1,2 it does a spiral at 2,2. The offset isnt always one as on a 10x10 grid with a start at 1,7 it will do a spiral at 4,7
Environment (please complete the following information):
Screenshots 0,2 to 1,2 offset visualized:
1,7 to 4,7 visualized: