In Talos Principle, from time to time player has to solve a puzzle that looks like this:

example Source: http://uk.ign.com/wikis/the-talos-principle/File%3A20141108_134749.jpg

This puzzle is already solved - the blue slots on the right are the list of the possible blocks the user could use. They were placed in the grid so that they don't overlap and all spaces are filled.

The goal is to create a random puzzle generator that assumes that the grid is 8x8 and lists available puzzles (16 letters as output). All blocks from Tetris are allowed (I, L, J, O, T, S and Z) and we assume that the player can rotate them. In the screenshot, the matrix is 4x7 and the program would say that the player has to use two I blocks, two T blocks, two Z blocks and one L block (rotated). The program should generate a puzzle in a reasonable time (let's say a minute on a 1Ghz processor with 8 gigabytes of RAM)

Winning Criteria : shortest source code and running within reasonable time, explained above.

  • \$\begingroup\$ Related challenge \$\endgroup\$
    – Sp3000
    Jul 16, 2015 at 10:24
  • 2
    \$\begingroup\$ How random is random? Is it that every possible combo needs to have a non-zero chance? Or is it uniform? \$\endgroup\$
    – Maltysen
    Jul 16, 2015 at 12:30
  • 2
    \$\begingroup\$ It would be useful if, in addition to showing what the puzzle looks like, you explained what the puzzle is. \$\endgroup\$ Jul 16, 2015 at 20:18
  • 2
    \$\begingroup\$ But if all don't have to be possible what's stopping me from doing print "IIIIIIIIIIIIIIII"? \$\endgroup\$
    – Maltysen
    Jul 17, 2015 at 2:13
  • 2
    \$\begingroup\$ Fine but that's not what I meant, what about random_choose("I"*16, "Other hardcoded puzzle that I cant think of at the moment") \$\endgroup\$
    – Maltysen
    Jul 17, 2015 at 8:03


Browse other questions tagged or ask your own question.