Settings

Theme

Show HN: Draw a map and let it be colored – Four color theorem demo

kleemans.ch

48 points by akleemans 10 years ago · 10 comments

Reader

dsr_ 10 years ago

In the other direction, Simon Tatham's puzzle collection (many implementations, including a good one on Android) generates maps for you to solve: http://www.chiark.greenend.org.uk/~sgtatham/puzzles/

gus_massa 10 years ago

Nice. I'd like an "uncolor" button. It's not very useful, but I'd like to see again how the map I have draw is colored.

  • akleemansOP 10 years ago

    I thought so too, this is why I added the "Generate Image" button, you can save your images even across resetting.

JoeAltmaier 10 years ago

Curiously, the theorem implies all maps on a sphere can also be colored. All 2D maps can be considered to be a sphere, by adding a new 'border state' that surrounds the existing 2D map and extends endlessly in all directions. The 2D theorem says this can also be colored.

That can be mapped to a sphere by laying the existing map on a sphere, and making that border state into the 'rest of the sphere'. You have to stretch things, sure. The colorability of the map is not affected by resizing or stretching the map. The fundamental layout of the map is determined by the vertices and edges, not how you 'look at it'.

This also implies that all 2D maps must be colorable in 3 colors on their perimeter. Because, I can always create a new map with that 'border state' that must also be colorable, and the new state can't be any color already on the perimeter. So, the perimeter can only be 3 colors.

The spherical transformation makes this more obvious: every state must have neighbors of at most 3 colors, and that border state is no different from any other.

notgood 10 years ago

Cool.

It doesn't complete when it gets a hard time deciding what is adjacent and what is not. E.g. http://i.imgur.com/5HWDB70.png

throwaway2016a 10 years ago

Does this use Web Workers? It seems like a great use for them. Although, I haven't been able to get it to take more than a half second on my system so I haven't noticed performance issues.

  • akleemansOP 10 years ago

    I didn't know about web workers until now, would be a nice to try! I'm not sure though if they work well with ProcessingJS...

cb18 10 years ago

impressive

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection