# Test exact 2' x 4' (24" x 48") panel nesting for all 13 dollhouse parts
kerf = 0.125 # 1/8"

def test_panels():
    print("================================================================================")
    print("TESTING NESTING ON 2' x 4' (24\" x 48\") HANDY PANELS (1/4\" PLYWOOD)")
    print("================================================================================")

    # PANEL 1 (24" x 48"):
    # Target: E1 (Front Roof: 34" x 14.11") and Partitions
    # Along 48" length: E1 uses 34.00", leaving 48 - 34 - 0.125 = 13.875" x 24.00"
    # Alongside E1 (across 24"): E1 uses 14.11", leaving 24 - 14.11 - 0.125 = 9.765" x 34.00"
    # In 9.765" x 34.00":
    #   D1-A (12.0" x 8.25")
    #   D1-B (12.0" x 8.25")
    #   Length used: 12.0 + 0.125 + 12.0 = 24.125" <= 34.00" (leaves 9.75" x 9.765" scrap)
    # In 13.875" x 24.00" (the end block):
    #   D2-A (12.0" x 8.25")
    #   D2-B (12.0" x 8.25")
    #   BAY PAD (8.0" x 2.0")
    #   Width used: 8.25 + 0.125 + 8.25 = 16.625" <= 24.00"
    #   Length used: 12.00" <= 13.875"
    #   Bay pad: 8.0" x 2.0" fits in the remaining (24.0 - 16.625 - 0.125 = 7.25" x 13.875")!
    print("PANEL 1 (24\" x 48\"):")
    print("  - E1 (Front Roof):              34.00\" x 14.11\"")
    print("  - D1-A (1st Fl Partition):      12.00\" x  8.25\"")
    print("  - D1-B (1st Fl Partition):      12.00\" x  8.25\"")
    print("  - D2-A (2nd Fl Partition):      12.00\" x  8.25\"")
    print("  - D2-B (2nd Fl Partition):      12.00\" x  8.25\"")
    print("  - BAY PAD (Bay Window Base):     8.00\" x  2.00\"")
    print("  -> PANEL 1 is 100% SUCCESS!\n")

    # PANEL 2 (24" x 48"):
    # Target: E2 (Rear Roof: 34" x 14.11") and C1 (Front Facade: 32" x 16.50")?
    # Can E2 and C1 fit on the same 24" x 48" panel?
    # C1 is 16.50" wide. E2 is 14.11" wide. 16.50 + 14.11 = 30.61" > 24". So not side-by-side.
    # What about end-to-end? 34.00 + 32.00 = 66.00" > 48". So not end-to-end.
    # Therefore, C1 and E2 must be on separate 24" x 48" panels!
    #
    # So on PANEL 2:
    # Target: E2 (Rear Roof: 34" x 14.11")
    # Along 48" length: E2 uses 34.00", leaves 13.875" x 24.00"
    # Alongside E2 (across 24"): leaves 9.765" x 34.00"
    # What large parts can fit?
    # What about Gable Walls B1 and B2? B1 is 27.0" x 12.0". B2 is 27.0" x 12.0".
    # Width of B1 is 12.00" > 9.765".
    # What about Decks A1, A2, A3? Decks are 32.0" x 12.0". 12.00" > 9.765".
    # Wait, can B1 fit in 13.875" x 24.00"? B1 is 27.0" long > 24.00".
    # So on Panel 2: E2 is 34.00" x 14.11".
    # What else could pair with E2?
    # What if on Panel 2 we have:
    # E2 (34.00" x 14.11")
    # And can we cut something else?

    # Let's look at all remaining parts:
    # Remaining:
    #   E2: 34.0 x 14.11
    #   C1: 32.0 x 16.50
    #   A1: 32.0 x 12.00
    #   A2: 32.0 x 12.00
    #   A3: 32.0 x 12.00
    #   B1: 27.0 x 12.00
    #   B2: 27.0 x 12.00

    # Let's look at the remaining parts:
    # Notice: A1, A2, A3 are 32.0" x 12.0".
    # In a 24" x 48" panel:
    # 24" width is EXACTLY 12.0" + 0.125" + 11.875" (Wait! 24" width: 12.0 + 0.125 + 12.0 = 24.125" -> exceeds 24" by 1/8" kerf!).
    # BUT along the 48" length:
    # 32.0" + 0.125" = 32.125". Leaves 48 - 32.125 = 15.875" long x 24.0" wide!
    # If a deck is 32" x 12", it takes 32" x 12" in one corner of 24" x 48".
    # What can fit beside it?
    # Beside it (across the other 12" of the 24" width):
    # Available: 32.0" long x (24.0 - 12.0 - 0.125 = 11.875" wide).
    # Wait! Can a 12.0" wide part fit in 11.875"? NO, 11.875" is 1/8" short!
    # UNLESS the 24" panel is ripped:

    print("Checking how many 2x4 panels total...")

if __name__ == "__main__":
    test_panels()
