gereleth / hexapipes

Hexagonal pipes puzzles
https://hexapipes.vercel.app/hexagonal/5
MIT License
186 stars 19 forks source link

Color picker sometimes chooses 2 identical colours #63

Open RandomUsernameThatIsNotYetTaken opened 1 year ago

RandomUsernameThatIsNotYetTaken commented 1 year ago

20221105_080759

See attached image, there are 2 separate parts in (almost) identical green colour.

Seems the randomisation screwed up?

gereleth commented 1 year ago

Well the random color is just that - random. It doesn't check if similar colors are present on the board. So this happens sometimes. Bad luck =).

I can leave this issue open in case someone wants to improve the logic of color selection. But personally I can live with how it is =).

RandomUsernameThatIsNotYetTaken commented 1 year ago

@gereleth I'll try and create a PR for this then. For something I start my day with everyday, I might as wel start helping out.

Jaybrainer commented 1 year ago

Can resolve this by assigning an incrementing ID to each group of connected pipes. Colours can then be assigned based off of the ID, with sufficient colours for expected IDs. Also can eliminate colouring single cell groups after a rotation, as this doesn't aid the solve, and will take up colours for other groups. A separate approach could be to only highlight the previously interacted group (this could just be an additional setting too if wanted).

mtmail commented 1 year ago

Another example I saw today image