# Constraint Specifications - code-golf/code-golf GitHub Wiki

(WIP - Improvements to wording, formatting, and information appreciated)

The goal of this page is to document the constraints of input holes on code.golf, including some details that may not be listed in the hole descriptions themselves. This page is not intended to list tips on solving holes, as the Hole-specific tips page already exists to do that.

On this page, `[x..y]` means the inclusive range from `x` to `y`.

ARGC - This page documents `argc`, the number of arguments for each hole. Although general constraints to holes rarely, if ever change, it is not uncommon for the number of arguments to a hole to sometimes be changed. As a result, solutions which hardcode `argc` may break over time. If you are editing a hole to add additional testcases, consider breaking it into multiple runs with the same `argc` as previous in order to avoid needlessly breaking solutions that hardcode `argc`.

RUNS - Some holes are "run" multiple times on different sets of inputs. What this means is that your code will be run independently on each set of inputs, and only be considered "passing" if it succeeds on all runs. Since these runs are completely separate, the number of runs has no direct effect on how your solution works, but it may still be useful to know what each run does. For example, the arguments of the hole "Emojify" are 25 ASCII emoticons. The hole is run 3 times: once with all 25 emoticons, and 2 more times with those inputs split into 2 groups of size 12 & 13.

## Arabic to Roman

`argc = 2000`

Each argument is an integer in [1..3999]. Each number in this range appears once, split into 2 runs of 2000 arguments each.

## Arrows

`argc in [27, 30..90]`

Each argument is a Unicode arrow pointing in 1 of 8 directions, or in no direction. The hole consists of 5 runs:

• 1 run consisting of [1..3] of each of the 30 arrows, resulting in an argc anywhere in [30..90].
• 4 runs where each contains only arrows pointing towards one of the 4 quadrants of the xy-plane. For example, a run with only these arrows `←⇐⇦↙↲⇙↓⇓⇩` for the negative-negative quadrant. 2 of these runs will have 3 of each arrow (argc = 27), the other 2 will have 4 of each arrow (argc = 36).

## brainfuck

`argc = 12`

Each argument is a program in the brainfuck programming language which outputs a line of printable ASCII followed by a newline character. Each program:

• Does not contain any characters which aren't brainfuck commands
• Does not contain the brainfuck "read input" command (`,`)
• Uses at most 27 memory cells left of the initial pointer location
• Has length in [46..205]

## CSS Colors

`argc = 148`

Each argument is the name of a color. The arguments form a full permutation of the 148 possible CSS color names.

(TO-DO)

(TO-DO)

## Emojify

`argc in [12, 13, 25]`

Each argument is one of 25 ASCII emoticon. The first run has 25 arguments, forming a full permutation. The 2nd and 3rd arguments form a full permutation split into 2 runs of size 12 and 13.

(TO-DO)

## Fractions

`argc = 128`

Each argument is a fraction in form `num/denom`, where `num` is in [0..250] and `denom` is in [1..250].

(TO-DO)

(TO-DO)

## Intersection

`argc in [107..276]`

Each argument is eight space-separated integers, like `x1 y1 w1 h1 x2 y2 w2 h2`.

`x1`, `y1`, `x2`, and `y2` are in [0..100].

`w1`, `h1`, `w2`, and `h2` are in [1..50].

## ISBN

`argc = 100`

Each argument is 10 numerical digits and 3 dashes, arranged in any of the following forms (where 0 can represent any digit):

• 0-000-00000-
• 0-0000-0000-
• 0-00000-000-
• 0-000000-00-
• 0-0000000-0-

(TODO)

## Levenshtein Distance

`argc = 20`

Each argument is a pair of space-separated lowercases words, each with [1..16] characters.

## Lucky Tickets

`argc = 20`

Each argument is a pair of space-separated numbers like `a b`.

`a` is in [2..14].

`b` is an even number in [2..16].

(TO-DO)

## Maze

`argc = 1`

There are 5 runs, each with a single 51x51 newline-separated maze (`total length of input = 2651`). The outside border of the maze is always solid walls (`#`). Mazes are designed with only one-char wide paths and walls (ie. 2x2 squares of solid walls or 2x2 blank squares do not occur).

## Medal Tally

`argc = 223`

Each argument is a space-separated list of [1..10] integers, each in [1..98].

## Morse Decoder

`argc = 1` See `Morse Encoder` below, but encoded as Morse code.

## Morse Encoder

`argc = 1`

A string is created containing 9 space-separated words: "BUD", "FOR", "JIGS", "NYMPH", "QUICK", "VEX", "WALTZ", the 10 numerical digits randomly arranged into a word, and the 26 uppercase letters randomly arranged into a word. This 72-character string is split into 2 parts of length 36, each of which as passed as the sole argument for a run.

## Musical Chords

`argc = 363`

Each argument is a valid triad consisting of 3 space-separated pitch class names. Of the 372 possible triads, 9 are chosen at random to be dropped, and the remaining 363 are passed as arguments.

(TO-DO)

(TO-DO)

## Pangram Grep

`argc = 76`

Each argument is a string consisting of up to 79 printable ASCII characters [0x20..0x7e] (" ".."~").

## Poker

`argc = 37`

Each argument is a hand of 5 poker cards [0x1f0al..0x1f0de] ("🂡".."🃞").

## QR Decoder

`argc = 1`

The argument is a QR code which encodes 17 ASCII characters [0x21..0x7e] ("!".."~").

(TO-DO)

## Reverse Polish Notation

`argc = 20`

Each argument is [1..253] characters long. Each argument is a space-separated list of `n` integers and `o` operators, where n is in [1..32] and `o = n - 1`. Each integer is in [0..32676]. Operators can be any of `+`, `-`, `/`, `*`.

(TO-DO)

## Rock-paper-scissors-Spock-lizard

`argc in [12, 13, 25]`

Each argument is a unique repeated 2-permutation of the allowed plays. The first run consists of all 25 such permutations, the 2nd and 3rd runs consist of those permutations split into 2 runs of 12 and 13.

## Roman to Arabic

`argc = 2000`

Each argument is an uppercase Roman representation of an integer in [1..3999]. Each number in this range appears once, split into 2 runs of 2000 arguments each.

## Seven Segment

`argc = 1`

The argument contains 2 of each numerical digit.

(TO-DO)

## Spelling Numbers

`argc = 1001`

Each argument is a number in [0..1000]. The arguments form a full permutation of these numbers.

## Star Wars Opening Crawl

`argc = 9`

Each argument consists of 2 space separated integers `i` and `w`, followed by the opening text crawls to one of the 9 Star Wars movies.

`i` is in [6..11]. `w` is in [14..49].

## Sudoku

`argc = 9`

Each argument is a row of an unsolved Sudoku board, with "_" representing unsolved cells. There are at most 50 unsolved cells.

## Sudoku v2

`argc = 1`

The input is a Unicode formatted Sudoku board with " " in unsolved cells. There are at most 50 unsolved cells.

## Ten-pin Bowling

`argc = 40`

Each argument represents ten space-separated frames of bowling, and is right-padded with spaces if necessary to be 30 characters long.

## Time Distance

`argc = 321`

Each argument is an integer in [-31535999999..31535999999]

(TO-DO)

## United States

`argc in [25, 26, 51]`

Each argument is a unique one of the 50 U.S. states plus District of Columbia. The first run is a full permutation of these 51 possibilities, the 2nd and 3rd runs consist of those permutations split into 2 runs of 25 and 26.

(TO-DO)

(TO-DO)