Show HN: I made a puzzle game that gently introduces my favorite math mysteries (opens in a new tab)rahulilango.com
1054 pointsThere were a lot of fun technical parts to building this:
- For implementation reasons, it’s much easier if the lines all have integer intersection points with each other. To do this, when a new line is added I “cheat” by rounding intersections to integers and then splitting the old lines at the intersection into new linds (with potentially different slopes) going through the rounded point
- I had to draw semi accurate maps of actual places (UK, South America, US west coast) in the HTML canvas using just line segments. I tried a few different solutions, including using SVG data. I ended up using the topojson library to give nice line approximations to GeoJSON maps
- I use a simple backtracking algorithm to handle the live coloring of graphs
- I use turf.js’s polygonize function to handle finding polygons from line segments (very happy I didn’t have to implement this myself!)
- I wanted to make the game as mobile friendly as possible (don’t think I’ve nailed this quite yet)
There were also a few tradeoffs I made:
- I wanted give links earlier in the game for players to learn more, but I decided to wait until the end to maintain the flow of the game
- In order to make the game more mobile-friendly, I generally stuck to maps with a small number of regions (at least for maps people have to interact with them). So for the most part all of the instances in the game are “easy”
Comments (172) 62 threads
Earlier commentshttps://en.wikipedia.org/wiki/Snark_(graph_theory)
First is that "One of the equivalent forms of the four color theorem is that every snark is a non-planar graph". Second, is as strengthened form of the four color theorem: "every snark has the Petersen graph as a minor", which is kind of proven (already 25 years ago), but still lacks 1 paper: https://thomas.math.gatech.edu/FC/generalize.html https://math.stackexchange.com/questions/3692582/what-is-the...
And another related concept is of nowhere-zero flows, and even more stronger conjecture that "every bridgeless graph with no Petersen minor has a nowhere zero 4-flow". https://en.wikipedia.org/wiki/Nowhere-zero_flow
And there I sit, knowing that every map of CONTIGUOUS territories can be colored with 4 colors - but on real world maps, there are enclaves - little islands that belong to a country that they have not connection to. And if those shall have the same color as their parent country, then 4 colors is not enough...
So I pick the answer "NO".
> you are wrong!!!!! every map can be colored with 4 colors! it has been proven!!!!!
Can you give an example of one that can't be colored with 4 colors?
If you insist giving those little islands the same color as the country they belong to, then things get difficult. That's not always doable in 4 colors.
see: https://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/4C...
(I bought Paul Lockhart's "measurements" but gave up because I felt like I needed a sandbox to play with and little hints. Like, I don't want to be told the answer but I want to know feedback exactly like this demo. Very simple: "this is not right" or "this is right, but can be done with fewer")
(My dream is to have a little game jam where we make interactive versions of these concepts as puzzle)
In order to need 5 colors, you'd need to construct a graph with 5 nodes where each of the nodes connects to all other nodes, but without any edges crossing: https://imgur.com/U52SFSi
You can just tell after playing around with the graph that it's impossible to move the nodes around on a 2d plane without an edge crossing; you need a 3rd dimension.
A 0-dimensional space needs up to: 1 color.
A 1-dimensional space needs up to: 2 colors.
A 2-dimensional space needs up to: 4 colors.
A 3-dimensional space needs up to: ∞ colors.
I can easily picture why a 3D space has no limit to the number of colors (personally I always imagine color blocks hanging in space connected to every other color block by bendable wires), but I don't quite understand why the pattern is that way.
Side note: indeed, 5-cliques are not planar: that is to say, there is no map you can draw that has five regions all bordering each other. This is not too difficult to prove, actually. Proving that 4 colours is enough is a whole different league!
[1]: https://en.wikipedia.org/wiki/Clique_(graph_theory)
[2]: https://www.rahulilango.com/coloring/wus
It has something very similar to a 4-clique that can be simplified to a 4-clique for the purposes of the coloring exercise: https://imgur.com/a/oRJBkFp
Or more generally, if you have any hub-and-spoke topology with an odd number of spokes, it can be simplified to a 4-clique and have the same properties.
So I concede that a graph requiring 5 colours doesn't have to have a 5-clique exactly, but it needs something that is either a 5-clique or can be simplified to a 5-clique.
I'm not a graph theory expert, so I'm assuming the complexity of the colors proof comes from the difficulty of being able to simplify complex graphs into simple atoms/cliques.
It so happens that planar graphs are K_5 minor free.
This is touching in on extremely deep theory in the graph theory field.
All comments shown.
Couldn't load more comments. Check your connection and try again.