I'm having trouble with the logic for this problem. I've got a grid of modules. Each module may take 1 or more cells on the grid, and each cell of a module may have 1 or more connectors. The connectors are represented by an enum (or int). Adjacent modules may only be placed if they have matching connectors.
So, for example:
-Module A in position (0, 1) has a down (3) connector. -Module B in position (0, 2) has an up (1) connector.
This is a valid configuration.
-Module A in position (0, 1) has a down (3) connector. -Module B in position (0, 2) has an right (2) connector.
This configuration is invalid.
I've attached an image below for clarity: