There are [40 ways][1] a directed [Hamiltonian path][2] can be arranged on a 3×3 grid: ![all 20 undirected Hamiltonian paths of a 3×3; grid][3] This graphic ([thanks Sp3000!][4]) shows only the 20 undirected paths. Traverse each colored line in both directions for the 40 directed paths. #Challenge Using only [printable ASCII][5], write a 3×3 grid of characters, such as: ABC DEF GHI When each of the 40 directed paths are read from this grid as 40 single-line, 9-character programs, the goal is to have each program output a unique integer from 1 to 40. Doing this for *all* 40 paths seems difficult and unlikely, so you only need to make it work for as many paths as you can. **The submission whose 40 path-programs output the most distinct numbers from 1 to 40 will be the winner. Tiebreaker goes to the earlier submission.** Path-programs that error or do not output an integer from 1 to 40 or output an integer that another path-program already covered are not counted. Specifically: - Programs that error while compiling, running, or exiting are not counted. Warnings are ok. - Programs that don't output an integer from 1 to 40 or output something slightly malformed such as `-35` or `35 36` are not counted. - Programs that require user input to produce the output are not counted. - Otherwise valid programs that output an integer from 1 to 40 that another valid program has already output are not counted. (The first program *is* counted.) - Only programs that output integer representations of numbers from 1 to 40 (inclusive) are counted towards your total. The numbers are expected to be in the usual `1`, `2`, ..., `39`, `40` format, unless that is not the norm for your language. (A trailing newline in the output is fine.) - Which numbers your programs output and what order they are in does not matter. Only the number of distinct integers from valid programs matters. **All path-programs must be run in the same language.** However, the "programs" may in fact be functions (with no required arguments) or [REPL][6] commands, as well as full programs, that print or return their target integer. You may mix and match between functions, REPL commands, and full programs. #Example If your 3×3 grid were ABC DEF GHI and your 40 programs and outputs looked like this ABCFEDGHI -> 26 ABCFIHEDG -> 90 ABCFIHGDE -> 2 ABEDGHIFC -> syntax error ADEBCFIHG -> prints 40 but then errors ADGHEBCFI -> 6 ADGHIFCBE -> 6 ADGHIFEBC -> 6 CBADEFIHG -> runtime error CBADGHEFI -> 3 CBADGHIFE -> 4 CFEBADGHI -> -32 CFIHEBADG -> 38.0 CFIHGDABE -> "36" EDABCFIHG -> 33 EFCBADGHI -> no output EHGDABCFI -> compilation error EHIFCBADG -> 8 GDABCFEHI -> 22 GHEDABCFI -> 41 IHGDEFCBA -> 0 GDEHIFCBA -> '9' EDGHIFCBA -> +10 CFIHGDEBA -> 11 GHIFCBEDA -> error IFCBEHGDA -> error EBCFIHGDA -> error CBEFIHGDA -> error GHIFEDABC -> error IFEHGDABC -> 30 EFIHGDABC -> 39 IHGDABEFC -> 7 GDABEHIFC -> 29 EBADGHIFC -> -1 GHIFCBADE -> 26 IHGDABCFE -> 1 IFCBADGHE -> error GDABCFIHE -> no output IHEFCBADG -> no output IFCBADEHG -> "quack" your score would be 14, because there are 14 distinct integers from 1 to 40 validly output, namely `26 2 6 3 4 33 8 22 11 30 39 7 29 1`. [1]: https://oeis.org/A096969 [2]: http://mathworld.wolfram.com/HamiltonianPath.html [3]: https://i.sstatic.net/6g51G.png [4]: https://chat.stackexchange.com/transcript/message/22631899#22631899 [5]: https://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters [6]: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop