Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro.
I have a friend who is an architect, and, after explaining the concept of code-golf and this site to him, he said that I should code something actually useful for a change. I asked him what he would consider useful, and, being an architect, he replied that he would enjoy having a floor planner that gave him all possible arrangements for rooms of certain sizes within a house of a certain size. I thought I would prove that code-golf wasn't useless after all, and give him this program in the smallest number of bytes possible.
Write a program or function that, when given an array D containing the dimensions of the entire house, and a second array R containing the dimensions of the interior rooms, output as ASCII art, all possible configurations of the rooms inside the house.
All rooms and the exterior walls of the house should be formed as standard ASCII boxes, using the | symbol for vertical walls, the - symbol as horizontal walls, and the + symbol for corners. For example, a house with the dimensions [4,4] will look like:
+----+ | | | | | | | | +----+
As you can see, corners do not count as part of a set of dimensions. The number of - or | characters forming a side should equal the number given in the dimensions. Rooms may share walls, or share walls with the house. A room may not contain smaller rooms within itself.
For example, the configuration
+--+---+-+ | | | | | | | | +--+---+ | | | | | +--------+
is valid for D=[5,8], and R=[[2,2],[2,3]].
Two arrays, one of which contains two integers, the dimensions for the house, and the other of which contains a series of arrays containing the dimensions for rooms.
Either an array of all possible houses as strings, or a string containing all possible houses, delimited in some consistent way. Note that rotations of the exact same configuration should only be counted once.
D R -> Output [4,3] [[2,1],[4,1]] -> +-+-+ +-+-+ +-+-+ Note that though there is an option to switch which side the [2,1] room and the [4,1] room are on, doing so would merely be rotating the house by 180 degrees, and therefore these possibilities do not count. | | | +-+ | | | | +-+ | | | | | | | | | | | | | +-+ | | | | +-+ | | | | +-+-+ +-+-+ +-+-+ [4,7] [[3,1],[4,2],[2,2] -> +----+--+ +----+--+ +----+--+ +----+--+ There are some more possiblities I didn't feel like adding, but it's the same four again, just with the [4,2] and the [2,2] room switched. | | | | | | | | | | | | | | | | | | | | | | | | +---++--+ +--+-+-++ +-+--++-+ ++---+--+ | | | | | || | | | | || | | +---+---+ +--+---++ +-+---+-+ ++---+--+
This is code-golf, lowest score in bytes wins!