This is the cop's thread. The robber's thread is here.
Write a code that takes an input n
and creates a n-by-n "snake matrix".
A snake matrix is a matrix that follows this pattern:
3-by-3:
1 2 3
6 5 4
7 8 9
and 4-by-4:
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
The exact output format is optional. You may for instance output [[1 2 3],[6 5 4],[7 8 9]]
, or something similar.
You must provide the language name, and a regex that fully matches your code. You can choose how detailed your regex should be. In the extreme, you can write a regex that matches every possible string, in which case it will be very easy to crack your code. You must also provide the output for n=4
, so that robbers know the exact format you have opted for.
You may use one of the regex-flavors that are available on regex101.com, or the Ruby flavor.
- PCRE (PHP)
- Javascript
- Python
- Golang
- Ruby
You must specify which one you are using.
Notes:
- You must support any reasonably large
n
. You may assume it won't overflow the datatype or memory. If the default datatype is 8-bit signed integers, then you can assumen<=11
, if it's unsigned 8-bit integers, then you can assumen<=15
. - The robbers have to match the submission's output format, except leading/trailing spaces and newlines, since that might have been stripped away by the SE formatting.
Winning criterion:
The winner will be the uncracked submission with the shortest regex, measured in number of characters.
If your post has remained uncracked for 7 days, then you may post the intended solution and mark your submission as safe.
.
. \$\endgroup\$