28
4
The challenge is simply; output the following six 2D integer arrays:
[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]
[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 19, 30, 39, 50, 59]]
[[ 4, 13, 22, 31, 44, 53],
[ 5, 14, 23, 36, 45, 54],
[ 6, 15, 28, 37, 46, 55],
[ 7, 20, 29, 38, 47, 60],
[12, 21, 30, 39, 52]]
[[ 8, 13, 26, 31, 44, 57],
[ 9, 14, 27, 40, 45, 58],
[10, 15, 28, 41, 46, 59],
[11, 24, 29, 42, 47, 60],
[12, 25, 30, 43, 56]]
[[16, 21, 26, 31, 52, 57],
[17, 22, 27, 48, 53, 58],
[18, 23, 28, 49, 54, 59],
[19, 24, 29, 50, 55, 60],
[20, 25, 30, 51, 56]]
[[32, 37, 42, 47, 52, 57],
[33, 38, 43, 48, 53, 58],
[34, 39, 44, 49, 54, 59],
[35, 40, 45, 50, 55, 60],
[36, 41, 46, 51, 56]]
What are these 2D integer arrays? These are the numbers used in a magic trick with cards containing these numbers:
The magic trick asks someone to think of a number in the range [1, 60], and give the one performing the magic trick all the cards which contain this number. The one performing the magic trick can then sum the top-left numbers (all a power of 2) of the given cards to get to the number the person was thinking of. Some additional explanation of why this works can be found here.
Challenge rules:
- You can output the six 2D integer arrays in any reasonable format. Can be printed with delimiters; can be a 3D integer array containing the six 2D integer arrays; can be a string-list of lines; etc.
- You are allowed to fill the bottom right position of the last four cards with a negative value in the range
[-60, -1]
or character'*'
instead of leaving it out to make the 2D integer arrays rectangular matrices (no, you are not allowed to fill them with0
or a non-integer likenull
/undefined
as alternative, with the exception of*
since a star is also used in the actual cards). - The order of the numbers in the matrices is mandatory. Although it doesn't matter for the physical magic trick, I see this challenge mainly as a matrix-kolmogorov-complexity one, hence the restriction on order.
The order of the matrices themselves in the output list can be in any order, since it's clear from the top-left card which matrix is which.
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language. - Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number
n
appears on thek
'th card; where my challenge is a KC-challenge to output the six matrices.) – Kevin Cruijssen – 2019-04-27T08:29:42.2471@DigitalTrauma Hm, I'm not so sure if this is really a duplicate, because your challenge is [tag:ascii-art] (not tagged as such, but it is), while this one allows you to output the array in a way more lenient format (not just four essentially identical ways). I can't vote to reopen, though, because I have a hammer. – Erik the Outgolfer – 2019-04-27T17:58:21.953
@EriktheOutgolfer Woops.. Forgot I have a hammer as well >.> Sometimes being able to close/open hammer is pretty annoying.. It had 2 votes already though, so with yours and mine in addition there were 4 open votes. But if someone wants to close it again I don't mind. They are indeed very similar, although his challenge is indeed an
[ascii-art]
challenge with strict (MD5) output rules, where mine are very flexible (and the rows/columns are swapped, and range is[1,60]
instead of[1,63]
; pretty minor differences, but still). – Kevin Cruijssen – 2019-04-27T18:02:43.963Looks like you didn't try to VTRO with an attitude of "this is my precious challenge!!!" at least... :P – Erik the Outgolfer – 2019-04-27T18:10:33.973
@EriktheOutgolfer No, that was indeed not my intention. :) If I knew about his challenge I probably wouldn't have posted mine in the Sandbox. But since it's already here I can see your earlier point, and I indeed see quite a bit of differences (although also just as many similarities) between the two challenges. If I would be like "my previous challenge :(" I would had already opened it as soon as the close-vote came in. ;P But I could understand it. Now that I'm remembered my vote is a hammer I'll leave it to others to open-vote it next time.. – Kevin Cruijssen – 2019-04-27T19:12:55.807
1I too forgot about the hammer. I still think this is close enough to vote to dup, though I'll defer to the wisdom of the community if it is reopened. – Digital Trauma – 2019-04-27T21:08:41.643
Not related to the challenge, but to the magic trick: other versions of those cards scramble the numbers (with the power of two in some convenient spot) so that how it works is less obvious. Unfortunately, this makes it a little more likely the chooser will miss a card, so the magician may want to have some patter ready in case that happens. – aschepler – 2019-04-29T12:07:17.343