This is a simple puzzle engine that builds the pieces "links" by their overlap when it starts. It then randomizes and checks its offset to it"s "lockable" neighbors to get a match. When pieces link they adopt the other "group"s" number and all move as one piece.
This engine relies on everlap, so it may not work well on more complex puzzles, or odd shaped ones.