logoalt Hacker News

dmoyyesterday at 11:07 PM4 repliesview on HN

While similarly playing brio with a two year old, I thought about a different dimension not mentioned here - super loose tolerances make the search space really weird.

In true 2-year-old fashion, my kid would bend the rules as much as possible by literally forcing pieces to the edge of their tolerance to make things fit that shouldn't fit. 8 piece circle yea, cool, but with a sufficiently old brio set handed down for 40 years or whatever, you can totally make a 7 piece "circle" thing.

So I decided some day I'll craft an interview question out of that, to see if people can figure out a good way to map a set of pieces laid out with given tolerance ranges for piece, see if it can connect, etc. Haven't thought about it enough to really polish it for an interview, but some day.


Replies

bryanrasmussentoday at 5:15 AM

>if people can figure out a good way to map a set of pieces laid out with given tolerance ranges for piece

so you work in some space where extremely good visual understanding and ability to abstract in 3 dimensions is a prerequisite?

RataNovatoday at 7:04 AM

That tolerance turns a clean combinatorial problem into a continuous one

NuclearPMtoday at 5:44 AM

Why would that be a good interview question?

akoboldfryingtoday at 12:03 AM

I immediately got nerd-sniped by this...

A heuristic could try all kinds of fun force-directed placement stuff. For an exact solver, I think your best bet would (unfortunately) be to finely quantise the possible positions and orientations of each piece, describe each piece by 2 sets of positioned unit vectors (the vectors in one set start at the centre positions of each "hole" and are directed towards the centre of the piece, the other set is similar but holds the "plug" positions and orientations), and say that a partial solution is feasible iff every "plug" position is sufficiently far from all other plugs, and either sufficiently far from all other holes or within some small tolerances (in terms of both distance and angle) of some other hole. Actually, you would probably also need to treat the piece body as a "nothing else can occupy these positions" constraint. I say "unfortunate" because the position and orientation grids would need to be very fine relative to the size of the pieces, leading to a large state space thus long running times.

I think it would be fun to look for solutions that maximise the "badness" (e.g., sum of distances between matched holes and plugs) :)