# Code Crosswords

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.

• 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.

• You're already bored with Code Tetris? – feersum Oct 25 '14 at 5:48
• @feersum Nobody is solving those. I'm hoping this one is easier on the robbers. – Calvin's Hobbies Oct 25 '14 at 5:59
• Header: sha512sum <<<", footer: "|head -c10 (in Bash). – jimmy23013 Oct 25 '14 at 7:34
• @user23013 Yikes. I think I'll forbid hashing. – Calvin's Hobbies Oct 25 '14 at 7:46
• @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 Oct 27 '14 at 0:32

# 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.

• Are you sure you didn't mix up Across and Down? – proud haskeller Oct 25 '14 at 19:13

# 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!

• Solved. Thanks for the challenge, that was really fun! :) – Martin Ender Oct 25 '14 at 15:45

# 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 * # _   |
+----------+     +----------+


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

• What is 5 down? – feersum Oct 25 '14 at 10:47
• @feersum 5 down is 0 (answer edited) – es1024 Oct 25 '14 at 10:49
• Does it compile with gcc and run without arguments? – grc Oct 25 '14 at 11:24
• @grc yes it does – es1024 Oct 25 '14 at 11:40
• Solution here – feersum Oct 25 '14 at 20:05

# 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         |
¯¯¯¯¯¯¯¯¯¯      ¯¯¯¯¯¯¯¯¯¯


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|
¯¯¯¯¯¯¯¯¯¯


# 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


a=49481
b=97381
x=


Footer:

printx[:10]

• To clarify, is the footer on it's own line or is the p right after each snippet? – Calvin's Hobbies Oct 25 '14 at 6:49
• @Calvin'sHobbies The footer begins on a new line. – grc Oct 25 '14 at 6:51
• Is A-across anything especially diabolical? I have a grid that works for everything except that one. – feersum Oct 27 '14 at 12:14
• @feersum It's a mathematical expression like the others, but it could be quite tricky. Remember, the output gets truncated to 10 characters. – grc Oct 27 '14 at 12:20
• Solution – feersum Oct 27 '14 at 13:45

# Javascript ES4 - 37 Darks, 10 Reserved

## Solved by bazzarg

### Boards

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


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. ;)

• Interesting 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 Oct 25 '14 at 6:48
• I 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 Oct 25 '14 at 7:06
• 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 Oct 25 '14 at 7:11
• User 23013 is right. 8.141592653589793 and [object Window] are too long. – Calvin's Hobbies Oct 25 '14 at 7:25
• 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 Oct 25 '14 at 9:38

## 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         |
----------


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'| ----------