Code Crosswords

22

This is a challenge. Answer here if you are a cop (crossword maker), answer the companion question if you are a robber (crossword solver). You may take on both roles.

Cops (Puzzlers)

Your task is to write a 10×10 crossword puzzle where, instead of words or phrases, snippets of code are the solutions to clues. Each clue will be a nonempty sequence of characters such that running the snippet of code it refers to will print the sequence to stdout.

Your post must include three things:

  1. Your blank 10×10 crossword grid, using # for darks (clue separators) and _ for lights (cells to be filled in).
    • Every horizontal or vertical sequence of 2 or more lights (bounded by darks or the grid edge) is an entry you must write a clue for. For convenience you should number these in the usual way (left-to-right, top-to-bottom) by replacing the _ at the start of each entry with a unique character identifier (e.g. 1, 2,..., A, B,...).
    • Your grid may have any number of darks.
    • Your grid may have any number of clues.
    • Horizontal entries are always read left-to-right and vertical ones top-to-bottom.
  2. A list of clues that contains every entry in your crossword, down and across.
    • Clues must contain at least 1 and no more than 10 characters.
    • If your clues contain spaces make sure they are obvious when you format your post.
  3. Header and footer code snippets, each 20 characters or less.
    • These run respectively before and after a solution snippet, and may help in renaming long built-ins and such.

The procedure for ensuring a clue matches its corresponding code snippet is:

  1. Concatenate the header, the snippet, and the footer: [header][snippet][footer].
  2. Run this as a normal program (independent of past runs) and look at what was printed to stdout.
  3. If this matches the clue the snippet is a valid solution.

For simplicity you may only use printable ASCII (hex codes 20 to 7E) throughout. The header and footer alone may also contain tabs and newlines.

Additional Notes

  • For any snippet, running [header][snippet][footer] should not take more than a minute on a decent modern computer.
  • You must specify your programming language (and version).
  • You may not use any common hashing algorithms.
  • You may not use external libraries.
  • Everything in your code must be deterministic, time invariant, and not need a network connection.
  • # and _ may occur in snippets (or anywhere else).
  • You may reveal some of the characters in the crossword as COTO has done. They still count as lights. Robbers are not required to use these, they are just nice hints.

Example

A simple example using Python 3. Header: p=print;t=5;. No footer.

Unsolved grid:

##########
1___2___##
_###_#####
_###_#####
_###_#####
####_#####
####_#####
###3______
####_#####
####_#####

Clues:

ACROSS
1: 8
3: A!
DOWN
1: 7
2: 10

Valid solution:

##########
print(8)##
(###+#####
7###=#####
)###5#####
####;#####
####p#####
###p('A!')
####t#####
####)#####

Robbers (Solvers)

Your task is to solve the crosswords posted by the cops. You must use the same exact programming language as the crossword was given in, but otherwise any solution that matches all the clues is valid.

You may not solve your own crosswords, and you may only attempt to answer each of the other crosswords once.

Remember to post your solutions in the companion question.

Scoring

If a crossword is solved within 72 hours it is no longer in the running. Once a crossword has lasted unsolved for 72 hours it is considered immune and the creator may post the solution (by editing their post and marking it immune).

The winning cop is the user who submitted the immune crossword with the fewest darks (#). In case of ties the highest voted submission wins. The solution must be posted for the answer to be accepted.

The winning robber is the user who solves the most crosswords. The tie-breaker is their sum of up-votes in the companion question.

Calvin's Hobbies

Posted 2014-10-25T03:38:29.543

Reputation: 84 000

Man, these take a while to make. I'm working on one, but I'm being intentional and careful in order to make one without darks, attempting to be devious. – mbomb007 – 2015-01-16T20:40:56.323

Is this still active? Can I post new things here? – ASCIIThenANSI – 2015-04-28T18:20:39.800

@ASCIIThenANSI You're welcome to, but there may not be many who will try to crack your entry. – Calvin's Hobbies – 2015-04-28T18:40:31.380

@Calvin'sHobbies OK. Thanks. I'm actually going to see if there's any for me to crack C: – ASCIIThenANSI – 2015-04-28T18:48:57.963

I thought this was a fun challenge. It's a pity there weren't many answers/robbers. – mbomb007 – 2017-02-21T18:05:35.170

@grc Sure. The snippet is appended directly to it. – Calvin's Hobbies – 2014-10-25T03:56:09.433

1You're already bored with Code Tetris? – feersum – 2014-10-25T05:48:43.130

3@feersum Nobody is solving those. I'm hoping this one is easier on the robbers. – Calvin's Hobbies – 2014-10-25T05:59:05.207

9Header: sha512sum <<<", footer: "|head -c10 (in Bash). – jimmy23013 – 2014-10-25T07:34:05.543

1@user23013 Yikes. I think I'll forbid hashing. – Calvin's Hobbies – 2014-10-25T07:46:09.477

Designing these crosswords is so much fun. Mine is in CJam, I'll post it later today – None – 2014-10-25T09:34:41.227

"...it is considered immune and the creator may post the solution." Edit it into the answer in this thread, or post it in the robbers thread and link to it? – None – 2014-10-25T11:28:09.933

1Damn, 10x10 is too small for some fun Mathematica grids. :D – Martin Ender – 2014-10-25T12:39:46.327

@professorfish It doesn't really matter but you can just edit the post here. Perhaps put the solution in spoiler tags. – Calvin's Hobbies – 2014-10-25T16:59:59.113

The winning cop is the user who submitted the immune crossword with the fewest darks (#). I think it should be the other way around, more darks makes it easier to solve so the more darks it has the less chances it wins. Winning with a lot of darks would be a lot harder than winning with none at all. Changing it this late into the competition wouldn't be nice though. – rodolphito – 2014-10-27T00:23:44.607

@Rodolvertice Then a solution with 100 darks would instantly win. – Calvin's Hobbies – 2014-10-27T00:24:48.823

2@Rodolvertice Though then again it could be said to have been said to be instantly solved...so maybe you're right. But I agree that it is too late to change that (making a good puzzle with no darks isn't exactly trivial). – Calvin's Hobbies – 2014-10-27T00:32:00.750

Answers

5

JavaScript, 0 darks – immune

 __________
|123456789A|
|B         |
|C         |
|D         |
|E         |
|F         |
|G         |
|H         |
|I         |
|J         |
 ----------

Here is the solution for all of you:

 __________
|~709-51+90|
|-0x33-31&8|
|8-42^07*70|
|306%4+0x34|
|0xb1204%51|
|-1+2+x>h--|
|'4'*32>>07|
|Math.E>2.7|
|8/2-1-7*22|
|'6'-025036|
 ----------
Header: var h=8,x=5;console.log(

Footer: );

Clues

Across
1. -671
B. 8
C. -460
D. 54
E. 33
F. false
G. 1
H. true
I. -151
J. -10776

Down
1. NaN
2. 15
3. "1131t2"
4. 64
5. -48
6. 49
7. 6
8. true
9. 8
A. 315

Let me know if you think there are any results that I miscalculated.

NinjaBearMonkey

Posted 2014-10-25T03:38:29.543

Reputation: 9 925

3Are you sure you didn't mix up Across and Down? – proud haskeller – 2014-10-25T19:13:25.397

3

Python

Solved by feersum

Here's one to start us off. I used Python 2.7.8 to obtain the clues. Good luck :)

I've revealed the last snippet since hashing is now disallowed. Also, the grid has 36 darks (I missed the scoring part when I made it).

I've revealed a few more characters to make it easier, but different solutions are fine too.

Crossword grid:

1_234##5##         * . ## ##
_#6_______         #  e /   
_#7__##_##         # * ##6##
8________#        3   %    #
##_#_##_##        ##5# ## ##
#9________        #a   *   b
##_#_##_##        ## # ## ##
A________#        b   7  1 #
##_####_##        ## #### ##
#hash('9')        #hash('9')

Clues:

ACROSS
1: 440380.9
6: 12328.7671
7: 72
8: 4519217.0
9: 79920L
A: 1.55826556
B: 7296021944

DOWN
1: 1211477643
2: 17353.0
3: 5.4
4: 1719.0
5: 7514613.78

Header:

a=49481
b=97381
x=

Footer:

print`x`[:10]

grc

Posted 2014-10-25T03:38:29.543

Reputation: 18 565

To clarify, is the footer on it's own line or is the p right after each snippet? – Calvin's Hobbies – 2014-10-25T06:49:33.610

@Calvin'sHobbies The footer begins on a new line. – grc – 2014-10-25T06:51:12.747

Is A-across anything especially diabolical? I have a grid that works for everything except that one. – feersum – 2014-10-27T12:14:59.577

@feersum It's a mathematical expression like the others, but it could be quite tricky. Remember, the output gets truncated to 10 characters. – grc – 2014-10-27T12:20:25.093

1Solution – feersum – 2014-10-27T13:45:01.327

@feersum Well done! – grc – 2014-10-27T13:48:40.093

3

Javascript ES4 - 37 Darks, 10 Reserved

Solved by bazzarg

Boards

   CLUE #         RESERVED
 __________      __________
|1  2 ###3#|    |     ### #|
| ## #45   |    | ## #I   4|
| ## ## # #|    |:##-## # #|
|6        #|    |         #|
| ## ## # #|    | ## ##.# #|
|7         |    |         ]|
| ## ## ###|    | ## ## ###|
|8   #9    |    | +  #   - |
| ## ## ###|    |'## ## ###|
| ##A      |    | ##   4   |
 ¯¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯¯¯¯¯

Header

a=3;I=9;t=

Footer

;console.log(t);

Clues

Across

  • 1 51
  • 4 true
  • 6 8.14159265 ...
  • 7 "90"
  • 8 0
  • 9 -10
  • A "HI"

Down

  • 1 5
  • 2 "2pac"
  • 3 3072
  • 5 false

Note that I've included a second representation of the board marked "reserved" to indicate ten lights with characters already filled in. These are to assist the solver and to restrict/disambiguate the possible solutions. I'm not sure whether Calvin wants to count these as darks or lights.

I've used the two separate representations since some of the filled-in characters are numbers and might be confused for clue numbers, and to declutter the board generally.

There are no whitespace characters in any of the solutions, although you're welcome to fill lights with whitespace characters if they work.

Original Solution

__________ |{},51###6#| |a##+#I/a<4| |:##-##[#<#| |5+Math.PI#| |}##+##.#+#| |[I+"0"][0]| |'##p##/###| |a+-a#a=~-I| |'##c##=###| |]##"\x48I"| ¯¯¯¯¯¯¯¯¯¯

As it turns out, bazzarg's solution for 9 across has the - in the wrong place, but the clue was supposed to be 10 instead of -10 (the clue and answer were originally different and I made the switch hastily). Hence we'll just say that two wrongs do make a right in this case. ;)

COTO

Posted 2014-10-25T03:38:29.543

Reputation: 3 701

1Interesting idea about the reserved characters. I won't make them count as darks because then people would have even more incentive to not use them. – Calvin's Hobbies – 2014-10-25T06:48:07.510

1I ran into the same problem while making a crossword but, this isn't valid. Clues must contain at least 1 and no more than 10 characters. – jimmy23013 – 2014-10-25T07:06:37.923

I don't know JavaScript but something like [object Window] (which is invalid anyway, as user N has pointed out) sounds like it depends on being run in a specific environment. If this is true shouldn't that be specified? – feersum – 2014-10-25T07:11:13.487

User 23013 is right. 8.141592653589793 and [object Window] are too long. – Calvin's Hobbies – 2014-10-25T07:25:49.127

I can truncate the expression for 6-across. It should be obvious what the number is (and how to generate it) regardless of the number of decimal places. As for 9-across, the output is indeed browser-specific (although I believe the format I've used is common to all five major browsers). I'll amend the actual answer in this case. – COTO – 2014-10-25T09:38:07.467

@MartinBüttner: Thanks for pointing that out. It's a white. – COTO – 2014-10-25T13:27:10.837

Is ES4 really what's meant here? (since that spec was never finalized, and is abandoned). Got most of the answers in browser (ES5) then reached one that looked..odd, so thought I'd check. – bazzargh – 2014-10-25T15:52:32.400

ES3, then? The current browser standard. It shouldn't require any of the ES6 features. – COTO – 2014-10-25T16:56:45.973

Solution posted – bazzargh – 2014-10-25T17:18:10.320

3

C - 26 darks, 5 reserved - solved by feersum

   Clue #          Reserved
+----------+     +----------+
|1_2__3_#4_|     |"      #  |
|_#_##_#5_#|     | # ## #  #|
|6___7_8___|     |      8   |
|_#_#9____#|     | # #     #|
|_#AB_#C___|     | #   #    |
|D_#E_____#|     |  #      #|
|_#F#_#_#_#|     | # # # # #|
|_#GH__#I__|     | #    #   |
|_##J_#K#_#|     | ##  # # #|
|L___#M____|     |2 * # _   |
+----------+     +----------+

Header

z[4]={9};main(_){_=

Footer

;printf("%d",_);}

Clues

ACROSS:
1. 48
4. -8
5. -2
6. 0
9. 73
A. 9
C. 0
D. 5
E. 0
G. -2
I. 0
J. 0
L. 18
M. 6247483

DOWN:
1. 45
2. 7680
3. 22
4. -97
5. 0
7. -1073741824
8. 8
B. 0
F. 42
H. 0
K. -2

es1024

Posted 2014-10-25T03:38:29.543

Reputation: 8 953

What is 5 down? – feersum – 2014-10-25T10:47:10.590

@feersum 5 down is 0 (answer edited) – es1024 – 2014-10-25T10:49:15.387

Does it compile with gcc and run without arguments? – grc – 2014-10-25T11:24:14.027

@grc yes it does – es1024 – 2014-10-25T11:40:49.113

Just so I'm not barking up the wrong tree: in M-across, the number has no significance in terms of bit twiddling and I see no realistic way of obtaining it arithmetically. Placing & into M1 gets us the address of _, but this number is ridiculously compiler- and even version-specific. Is this what you were driving at, or is M-across obtainable without converting pointers to ints? – COTO – 2014-10-25T14:08:50.787

I've solved this one, barring resolution of the above issue. – COTO – 2014-10-25T15:37:11.843

2Solution here – feersum – 2014-10-25T20:05:18.503

Was there a well-defined way to get 7down? – feersum – 2014-10-25T20:48:01.643

@feersum the original solution also used >>~_ – es1024 – 2014-10-25T20:58:51.057

3

CJam, 41 darks - solved by Martin Büttner

No header, footer or reserved squares. Let me know of any potential bugs.

The solution I originally had in mind had no whitespace - it is not the one that Martin Büttner found.

Board

#5###6#7__
#4_3____##
1##_#_#_#A
2____##_#_
_##_##9___
_##_#E#_#_
_#C#8_____
##_#_####_
##B_______
D__#_####_

Clues

Across

2: [[4 3]]
4: 24717
7: 32
8: E
9: "" (there is ONE trailing space after the quotes)
B: "m
D: 124

Down

1: [2 2 2 3]
3: 3010936384
5: 2017
6: "18"
7: ' "\"\""
8: !{}
A: -3u3
C: -1
E: Stack: ""

Good luck!

user16402

Posted 2014-10-25T03:38:29.543

Reputation:

4Solved. Thanks for the challenge, that was really fun! :) – Martin Ender – 2014-10-25T15:45:09.953

3

MATLAB - 28 Darks

Solved by feersum

Boards

  CLUE #         RESERVED
 __________      __________
|12 3 4 5  |    |    [     |
|# # # # ##|    |#s# # # ##|
|6   # #7 8|    |    # #   |
|# # # # # |    |# # # # # |
|9 A       |    |6  7  y   |
|#B  # # # |    |#   # # # |
|C         |    |        g |
|# # ### # |    |# # ### # |
|# # ##D # |    |# # ##  # |
|E         |    |d         |
 ¯¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯¯¯¯¯

Header

g=4;o=magic(3);disp(

Footer

);

Clues

Across

  • 1 2
  • 6 -1i
  • 7 eye(3)
  • 9 0
  • B sqrt(-1)
  • C 1/25000
  • D 0
  • E [0;0;0]

Down

  • 2 log(1i)
  • 3 100
  • 4 10^16
  • 5 [2,2;2,2]
  • 8 512
  • A inv(1i)
  • D zeros(3)

Note that I've changed things up slightly in the clues for this puzzle. Since MATLAB outputs are invariably verbose (for example, even printing the imaginary unit 1i exceeds 10 characters [0 + 1.0000i]) and change depending on the default output format, the clues are all simple expressions whose displayed output is equivalent to that of the corresponding solutions.

In other words, you can consider an actual clue to be disp( CLUE ), where CLUE is the 10-character-or-less clue in the above lists.

Hopefully Calvin doesn't mind. I don't believe this violates the spirit of the clue length rule, which is likely to prevent crossword builders from inserting extremely-hard-to-generate solutions (i.e. words).

Key

    KEY
 __________
|max([1 2])|
|#s#1#0#*##|
|1i^3#*#o\o|
|#n#+#1#n#(|
|6 -7+eye&1|
|#(i)#1#s# |
|.1 ^ 5*(g)|
|#)#2### #^|
|#*#/##~2# |
|diag(-o)>3|
 ¯¯¯¯¯¯¯¯¯¯ 

COTO

Posted 2014-10-25T03:38:29.543

Reputation: 3 701

2solved here – feersum – 2014-10-26T22:38:55.517

1

Python 2, 0 darks - Immune

Python 2 is only because of the print in the footer. It should work the same way in Python 3 if you change the print statement.

I had fun making this, and overall I'm satisfied and a bit excited about the final result.

Let me know if you think my footer is too cruel (if I knew you could refrain from using a program to brute force it, I'd remove the cruelty.) Fun fact: the variables in the header spell 'bread'.

 __________
|123456789A|
|B         |
|C         |
|D         |
|E         |
|F         |
|G         |
|H         |
|I         |
|J         |
 ----------

Header:

b=7;r=3;e=6;a=.1;d=

Footer:

;print 2*str(d)[::3]

Clues:

Across

1. 74
B. 282.e2
C. 77
D. 8
E. 94
F. 247351.862e1
G. 99
H. -5312-5312
I. -32
J. 300000

Down

1. 61000
2. 251
3. 09333.8333
4. 7878
5. -70
6. -0045.164
7. 88
8. 61225
9. -350
A. 69971

Solution

__________ |r+111-37-r| |'2.48e+22'| |6+765-0*56| |30/7%140*2| |0xe6b/0x27| |18**+9.1-9| |047--01551| |04/-7.0131| |0-1512%989| |'30000700'| ----------

mbomb007

Posted 2014-10-25T03:38:29.543

Reputation: 21 944