Post History
Given a hexomino, indicate whether it is a net of a cube. Input A 6 by 6 grid containing exactly 6 filled squares. The 6 filled squares will be in a single edge connected set (a hexomino). Th...
#1: Initial revision
Net or not?
Given a [hexomino], indicate whether it is a net of a cube. ## Input - A 6 by 6 grid containing exactly 6 filled squares. - The 6 filled squares will be in a single edge connected set (a hexomino). - The topmost row and leftmost column will never be empty (the hexomino will be as far up and left as it can go). - The grid is represented as 6 newline separated strings of 6 characters, with `#` for a filled square and `.` for an empty square. ## Output - One of 2 distinct values to indicate whether the hexomino can be folded to give a cube. ## The hexominoes A hexomino is an edge connected subset of the square tiling, composed of exactly 6 squares. Up to rotation and reflection, there are 35 edge connected hexominoes, 11 of which are nets of a cube. ### The 35 hexominoes[^1] [![The 35 hexominoes]][The 35 hexominoes Wikimedia page] ### The 11 nets of a cube[^2] [![The 11 nets of a cube]][The 11 nets of a cube Wikimedia page] Your code must also accept inputs that are rotations and reflections of these. There are a total of 216 hexominoes including all rotations by a multiple of 90 degrees and reflections, 64 of which are cube nets. The test cases include all of these. ## Test cases ### Cube nets The 64 hexominoes that can be folded into a cube. ```text #..... ####.. #..... ...... ...... ...... .#.... .#.... .#.... ###... ...... ...... ...#.. ####.. ...#.. ...... ...... ...... ###... .#.... .#.... .#.... ...... ...... .##... .#.... .#.... ##.... ...... ...... ...#.. ####.. #..... ...... ...... ...... ##.... .#.... .#.... .##... ...... ...... #..... ####.. ...#.. ...... ...... ...... ##.... .###.. .#.... ...... ...... ...... #..... ###... .#.... .#.... ...... ...... ..#... ###... .#.... .#.... ...... ...... .#.... .###.. ##.... ...... ...... ...... .#.... .#.... ###... #..... ...... ...... ..##.. ###... ..#... ...... ...... ...... .#.... .#.... ###... ..#... ...... ...... ..#... ###... ..##.. ...... ...... ...... ##.... .##... ..##.. ...... ...... ...... #..... ##.... .##... ..#... ...... ...... ..##.. .##... ##.... ...... ...... ...... ..#... .##... ##.... #..... ...... ...... ###... ..###. ...... ...... ...... ...... ..###. ###... ...... ...... ...... ...... #..... #..... ##.... .#.... .#.... ...... .#.... .#.... ##.... #..... #..... ...... .#.... ###... .#.... .#.... ...... ...... .#.... .#.... ###... .#.... ...... ...... ..#... ####.. ..#... ...... ...... ...... .#.... ####.. .#.... ...... ...... ...... .#.... ###... ..##.. ...... ...... ...... ..#... .##... ##.... .#.... ...... ...... ##.... .###.. ..#... ...... ...... ...... .#.... .##... ##.... #..... ...... ...... #..... ##.... .##... .#.... ...... ...... ..##.. ###... .#.... ...... ...... ...... ..#... .###.. ##.... ...... ...... ...... .#.... ##.... .##... ..#... ...... ...... #..... ##.... .#.... .##... ...... ...... ..##.. ###... #..... ...... ...... ...... ##.... .#.... .##... ..#... ...... ...... .##... .#.... ##.... #..... ...... ...... ##.... .###.. ...#.. ...... ...... ...... #..... ###... ..##.. ...... ...... ...... ..#... .##... .#.... ##.... ...... ...... ...#.. .###.. ##.... ...... ...... ...... ...#.. ####.. ..#... ...... ...... ...... .##... ##.... .#.... .#.... ...... ...... ##.... .##... .#.... .#.... ...... ...... .#.... ####.. #..... ...... ...... ...... #..... ####.. .#.... ...... ...... ...... .#.... .#.... ##.... .##... ...... ...... .#.... .#.... .##... ##.... ...... ...... ..#... ####.. ...#.. ...... ...... ...... .#.... .##... ##.... .#.... ...... ...... .#.... ####.. ..#... ...... ...... ...... ..#... ####.. .#.... ...... ...... ...... .#.... ##.... .##... .#.... ...... ...... .#.... .##... .#.... ##.... ...... ...... .#.... ##.... .#.... .##... ...... ...... .##... .#.... ##.... .#.... ...... ...... ##.... .#.... .##... .#.... ...... ...... #..... ####.. ..#... ...... ...... ...... ..#... ####.. #..... ...... ...... ...... ...#.. ####.. .#.... ...... ...... ...... .#.... ####.. ...#.. ...... ...... ...... ``` ### Not cube nets The 152 hexominoes that cannot be folded into a cube. ```text ..#... #####. ...... ...... ...... ...... #####. ..#... ...... ...... ...... ...... .#.... .#.... ##.... .#.... .#.... ...... #..... #..... ##.... #..... #..... ...... .##... ###... .#.... ...... ...... ...... ##.... ###... .#.... ...... ...... ...... .#.... ###... ##.... ...... ...... ...... .#.... ###... .##... ...... ...... ...... ##.... .####. ...... ...... ...... ...... ####.. ...##. ...... ...... ...... ...... #..... ##.... .#.... .#.... .#.... ...... ...##. ####.. ...... ...... ...... ...... .#.... .#.... .#.... ##.... #..... ...... #..... #..... #..... ##.... .#.... ...... .#.... ##.... #..... #..... #..... ...... .####. ##.... ...... ...... ...... ...... .#.... ##.... ###... ...... ...... ...... #..... ###... ##.... ...... ...... ...... ###... ##.... .#.... ...... ...... ...... ##.... ###... #..... ...... ...... ...... ###... .##... .#.... ...... ...... ...... .##... ###... ..#... ...... ...... ...... ..#... ###... .##... ...... ...... ...... .#.... .##... ###... ...... ...... ...... ###... ..#... ..##.. ...... ...... ...... ..#... ..#... ###... #..... ...... ...... ..#... ###... #..... #..... ...... ...... #..... ###... ..#... ..#... ...... ...... .###.. .#.... ##.... ...... ...... ...... #..... #..... ###... ..#... ...... ...... ..##.. ..#... ###... ...... ...... ...... ##.... .#.... .###.. ...... ...... ...... ####.. ##.... ...... ...... ...... ...... .#.... .#.... ##.... ##.... ...... ...... ..##.. ####.. ...... ...... ...... ...... #..... #..... ##.... ##.... ...... ...... ##.... ##.... .#.... .#.... ...... ...... ##.... ####.. ...... ...... ...... ...... ##.... ##.... #..... #..... ...... ...... ####.. ..##.. ...... ...... ...... ...... ####.. .#.... .#.... ...... ...... ...... ..#... ..#... ####.. ...... ...... ...... ..#... ..#... ###... ..#... ...... ...... #..... #..... ###... #..... ...... ...... #..... ###... #..... #..... ...... ...... ####.. ..#... ..#... ...... ...... ...... .#.... .#.... ####.. ...... ...... ...... ..#... ###... ..#... ..#... ...... ...... ####.. #.#... ...... ...... ...... ...... .#.... ##.... .#.... ##.... ...... ...... #.#... ####.. ...... ...... ...... ...... #..... ##.... #..... ##.... ...... ...... ##.... .#.... ##.... .#.... ...... ...... .#.#.. ####.. ...... ...... ...... ...... ####.. .#.#.. ...... ...... ...... ...... ##.... #..... ##.... #..... ...... ...... ...#.. ...#.. ####.. ...... ...... ...... ####.. ...#.. ...#.. ...... ...... ...... ..#... ..#... ..#... ###... ...... ...... ###... ..#... ..#... ..#... ...... ...... ###... #..... #..... #..... ...... ...... #..... #..... #..... ###... ...... ...... #..... #..... ####.. ...... ...... ...... ####.. #..... #..... ...... ...... ...... .##... ##.... .##... ...... ...... ...... #.#... ###... .#.... ...... ...... ...... ##.... .##... ##.... ...... ...... ...... .#.... ###... #.#... ...... ...... ...... ##.... ##.... .##... ...... ...... ...... #..... ###... .##... ...... ...... ...... ..#... ###... ##.... ...... ...... ...... .##... ###... #..... ...... ...... ...... .##... ##.... ##.... ...... ...... ...... ##.... .##... .##... ...... ...... ...... ##.... ###... ..#... ...... ...... ...... .##... .##... ##.... ...... ...... ...... #..... ##.... ###... ...... ...... ...... ..#... .##... ###... ...... ...... ...... ###... .##... ..#... ...... ...... ...... ###... ##.... #..... ...... ...... ...... ###### ...... ...... ...... ...... ...... #..... #..... #..... #..... #..... #..... .###.. ##.... .#.... ...... ...... ...... .#.... ###... #..... #..... ...... ...... .#.... ###... ..#... ..#... ...... ...... ..#... ..#... ###... .#.... ...... ...... ###... ..##.. ..#... ...... ...... ...... .#.... ##.... .###.. ...... ...... ...... ..#... ..##.. ###... ...... ...... ...... #..... #..... ###... .#.... ...... ...... #.#... ###... #..... ...... ...... ...... #.#... ###... ..#... ...... ...... ...... #..... ###... #.#... ...... ...... ...... ##.... .#.... ###... ...... ...... ...... ..#... ###... #.#... ...... ...... ...... ###... .#.... ##.... ...... ...... ...... .##... .#.... ###... ...... ...... ...... ###... .#.... .##... ...... ...... ...... ###... ###... ...... ...... ...... ...... ##.... ##.... ##.... ...... ...... ...... #####. ....#. ...... ...... ...... ...... ....#. #####. ...... ...... ...... ...... #####. #..... ...... ...... ...... ...... ##.... #..... #..... #..... #..... ...... .#.... .#.... .#.... .#.... ##.... ...... #..... #..... #..... #..... ##.... ...... ##.... .#.... .#.... .#.... .#.... ...... #..... #####. ...... ...... ...... ...... #..... #.#... ###... ...... ...... ...... ###... #..... ##.... ...... ...... ...... ###... #.#... #..... ...... ...... ...... ###... ..#... .##... ...... ...... ...... ##.... #..... ###... ...... ...... ...... ###... #.#... ..#... ...... ...... ...... ..#... #.#... ###... ...... ...... ...... .##... ..#... ###... ...... ...... ...... ###... .###.. ...... ...... ...... ...... .#.... ##.... ##.... #..... ...... ...... #..... ##.... ##.... .#.... ...... ...... .###.. ###... ...... ...... ...... ...... ##.... .##... ..#... ..#... ...... ...... ###... ..##.. ...#.. ...... ...... ...... ..#... ..#... .##... ##.... ...... ...... .##... ##.... #..... #..... ...... ...... .###.. ##.... #..... ...... ...... ...... #..... ##.... .###.. ...... ...... ...... #..... #..... ##.... .##... ...... ...... ...#.. ..##.. ###... ...... ...... ...... .##... ####.. ...... ...... ...... ...... #..... ##.... ##.... #..... ...... ...... .#.... ##.... ##.... .#.... ...... ...... ####.. .##... ...... ...... ...... ...... ##.... .#.... ##.... #..... ...... ...... ##.... #..... ##.... .#.... ...... ...... ##.#.. .###.. ...... ...... ...... ...... .###.. ##.#.. ...... ...... ...... ...... #.##.. ###... ...... ...... ...... ...... .#.... ##.... #..... ##.... ...... ...... ###... #.##.. ...... ...... ...... ...... #..... ##.... .#.... ##.... ...... ...... .#.... ##.... .#.... .#.... .#.... ...... ...#.. #####. ...... ...... ...... ...... #..... #..... #..... ##.... #..... ...... .#.... #####. ...... ...... ...... ...... .#.... .#.... .#.... ##.... .#.... ...... #####. ...#.. ...... ...... ...... ...... #..... ##.... #..... #..... #..... ...... #####. .#.... ...... ...... ...... ...... #..#.. ####.. ...... ...... ...... ...... ##.... .#.... .#.... ##.... ...... ...... ####.. #..#.. ...... ...... ...... ...... ##.... #..... #..... ##.... ...... ...... ``` ## Scoring This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins. > Explanations are optional, but I'm more likely to upvote answers that have one. [^1]: Thanks to [The 35 hexominoes Wikimedia page]. [^2]: Thanks to [The 11 nets of a cube Wikimedia page]. [hexomino]: https://en.wikipedia.org/wiki/Hexomino [The 35 hexominoes]: https://upload.wikimedia.org/wikipedia/commons/0/02/All_35_free_hexominoes.svg [The 35 hexominoes Wikimedia page]: https://en.wikipedia.org/wiki/File:All_35_free_hexominoes.svg [The 11 nets of a cube]: https://upload.wikimedia.org/wikipedia/commons/c/cd/The_11_cubic_nets.svg [The 11 nets of a cube Wikimedia page]: https://en.wikipedia.org/wiki/File:The_11_cubic_nets.svg [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"