This weekend I've finished the matching minigame, Also added multiple difficulties, just don't go above 5 - 6, the code has to find free space for the items and if there's too many of them, with not enough space, your game might freeze.
The code is in the attachments.