Back to Problem Solutions forum
Is this problem broken? The test cases make no sense, how can the distance be a decimal number? How can I possibly 2 and slightly more than half hexagons to get to the origin?
Andrew, Hi!
Is this problem broken?
...yet solved by 700+ people, as I see... probably, not broken :)
The test cases make no sense, how can the distance be a decimal number?
It's euclidean distance, not count of steps. Let's add this small clarification to the problem statement.
So how do you find this? When I tried to google for it, it requires the height and width of the hexagons.
https://stackoverflow.com/questions/20290140/calculate-grid-distance-between-hexagons
it requires the height and width of the hexagons
sure :) and you should be able to figure out whatever dimensions of hexagons you like from the statement:
distance between centers of two adjacent cells (i.e. sharing a side) is 1.0
The height and width is 1x1 in that case, right? If so it doesn't work with the formulas I could find. I might be really dumb or something but some of these feel far more like math questions than programming questions...
The height and width is 1x1 in that case, right?
No, I don't thinks this could be completely true as hexagon is not square! Simply "width and height" of hexagon are somewhat bewildering terms, you'd better avoid using them.
I might be really dumb or something
No, I guess it's all right with you :) Just take pencil and paper, draw few hexagons as a part of such grid, mark
distances of 1.0
between their centers... Scrap some bits of school geometry and most probably that would help. Feel
free to share your drawing if further hints are needed!
You see, it's a good example that answer at forum can give hint, but not necessarily understanding...
more like math questions than programming questions...
I'd say geometry... But dealing with graphics interface in programming, especially games, usually requires some minimal calculations, right. You will probably agree that programming "in abstract" unrelated to any real-world field is not always well-paid... :)
By the way generally there is nothing bad in skipping the problem to return to it later!