Lurker News
Hi all, hope someone enjoys (or not) my weekend project. See how many matching pairs you can find in two minutes.

This is written in C++ and built to WebAssembly with Emscripten. The code is at https://github.com/0xf00ff00f/rotator

Comments (195) 98 threads

Show all comments

Showing thread 26 of 98

akomtu#
That's brutal. On my first attempt I've matched only 2 shapes. The naive approach is to match each pair, and with 15 pairs total, that's gonna take time, even though you need to check only 7.5 pairs on average. A better approach is to "hash" each shape and find the duplicate hash in linear time, which is 3 comparisons on average. The hash can be computed logically, by counting turns the shape takes, or, after looking at hundreds of such shapes, one should be able to "hash" shapes subconsciously, and that will be a dramatic speed up.

I suggest you make a similar problem: matching small isomorphic graphs. I think that's what a lot of software engineeting is really about.