Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator.createHexagonGrid doc comment / functionality missmatch #10

Closed
mgrider opened this issue Jul 25, 2022 · 2 comments
Closed

Generator.createHexagonGrid doc comment / functionality missmatch #10

mgrider opened this issue Jul 25, 2022 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@mgrider
Copy link
Contributor

mgrider commented Jul 25, 2022

The comment for the radius parameter says 0 will produce a single hexagon, but a value of 0 actually throws an InvalidArgumentError.

I also think the doc comments for GridShape cases could use expanding, maybe with some examples. For instance, the .hexagon case just says "radius", but I think it's more common to talk about regular hex grids by "side length" (which is of course "radius + 1"). At least I understand the meaning of radius, but I don't really understand what the .triangle's "side size" parameter means, because it seems to produce a triangle with a side-size of one more than that. (For consistency?) Maybe the triangle parameter is actually a bug, I don't really know.

@fananek fananek added bug Something isn't working enhancement New feature or request labels Jul 26, 2022
@fananek
Copy link
Owner

fananek commented Jul 26, 2022

These are very valid points. Thank you.

The first one is a bug. The other two are more about a consistent and intuitive approach.
All of them have in release 0.4.8. Please note this is a breaking change!

New behavior:
Grid generator now accepts side length argument for both hexagon and triangle-shaped grids. This side length works as you would expect in the real world.

Examples:

  • hexagon-shaped grid of side length equal to 1 produces a grid of exactly 1 cell.
  • hexagon-shaped grid of side length equal to 2 produces a grid of 7 cells.
  • hexagon-shaped grid of side length equal to 3 produces a grid of 19 cells.
  • triangle-shaped grid of side length equal to 1 produces a grid of exactly 1 cell.
  • triangle-shaped grid of side length equal to 2 produces a grid of 3 cells.
  • triangle-shaped grid of side length equal to 3 produces a grid of 6 cells.
  • triangle-shaped grid of side length equal to 4 produces a grid of 10 cells.

@fananek fananek closed this as completed Jul 26, 2022
@mgrider
Copy link
Contributor Author

mgrider commented Jul 27, 2022

This is great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants