prompt:
Respelling C4 on B returns None because the octave holding B#3 is outside the search window.

Input [note, letter]. note: letter, accidentals (# +1, b -1, x +2), nonnegative octave. Return the same sounding pitch spelled on the requested letter in whichever octave needs the fewest accidentals, rendering +2 x, +1 #, -1 b, -2 bb; octave numbers follow the letter (B#3 = C4). If more than two accidentals would be needed return None.

split: open-access


meaning: Fixture-count band, not measured model difficulty

deps: stdlib

prompt:
G4 cannot be respelled as Abb4 and G4 on F returns None instead of Fx4.

Input [note, letter]. note: letter, accidentals (# +1, b -1, x +2), nonnegative octave. Return the same sounding pitch spelled on the requested letter in whichever octave needs the fewest accidentals, rendering +2 x, +1 #, -1 b, -2 bb; octave numbers follow the letter (B#3 = C4). If more than two accidentals would be needed return None.

split: open-access


prompt:
C4 respelled on B is printed B#4 and B3 on C is printed Cb3, an octave off in both cases.

Input [note, letter]. note: letter, accidentals (# +1, b -1, x +2), nonnegative octave. Return the same sounding pitch spelled on the requested letter in whichever octave needs the fewest accidentals, rendering +2 x, +1 #, -1 b, -2 bb; octave numbers follow the letter (B#3 = C4). If more than two accidentals would be needed return None.

split: open-access


prompt:
C#4 respelled on D prints D#4 instead of Db4: every accidental points the wrong way.

Input [note, letter]. note: letter, accidentals (# +1, b -1, x +2), nonnegative octave. Return the same sounding pitch spelled on the requested letter in whichever octave needs the fewest accidentals, rendering +2 x, +1 #, -1 b, -2 bb; octave numbers follow the letter (B#3 = C4). If more than two accidentals would be needed return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = (base[tonic[0]] + 7 * acc + 5) % 12 - 5
    if mode == 'minor':
        fifths -= 3
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['C#', 'minor'], 4)], [(['C#', 'major'], 7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['Cb', 'major'], -7), (['E', 'minor'], 1), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['F', 'minor'], -4)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['F', 'minor'], -4), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['G#', 'minor'], 5), (['A#', 'minor'], 7), (['Fb', 'major'], None), (['C', 'dorian'], None), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['Bb', 'major'], -2)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = (base[tonic[0]] + 7 * acc + 6) % 12 - 6
    if mode == 'minor':
        fifths -= 3
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['C#', 'minor'], 4)], [(['C#', 'major'], 7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['Cb', 'major'], -7), (['E', 'minor'], 1), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['F', 'minor'], -4)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['F', 'minor'], -4), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['G#', 'minor'], 5), (['A#', 'minor'], 7), (['Fb', 'major'], None), (['C', 'dorian'], None), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['Bb', 'major'], -2)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Gb major reports six sharps and C# major reports one sharp: enharmonic keys collapse onto one pitch class.

Input [tonic, mode] with tonic a letter optionally followed by one # or b, and mode major or minor. The signature is the letter position on the line of fifths (F -1, C 0, G 1, D 2, A 3, E 4, B 5) plus 7 per sharp and minus 7 per flat; minor keys use the relative major, three fifths flatward. Return the count (positive sharps, negative flats) or None if it lies outside -7..7 or the input is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths += 3
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['A', 'minor'], 0), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['E', 'minor'], 1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['D#', 'minor'], 6)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['A#', 'minor'], 7), (['Fb', 'major'], None)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['Fb', 'major'], None), (['B#', 'major'], None), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['Eb', 'minor'], -6), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths -= 3 if acc == 0 else 0
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['A', 'minor'], 0), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['E', 'minor'], 1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['D#', 'minor'], 6)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['A#', 'minor'], 7), (['Fb', 'major'], None)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['Fb', 'major'], None), (['B#', 'major'], None), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['Eb', 'minor'], -6), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A minor reports three sharps and D minor two sharps instead of zero and one flat.

Input [tonic, mode] with tonic a letter optionally followed by one # or b, and mode major or minor. The signature is the letter position on the line of fifths (F -1, C 0, G 1, D 2, A 3, E 4, B 5) plus 7 per sharp and minus 7 per flat; minor keys use the relative major, three fifths flatward. Return the count (positive sharps, negative flats) or None if it lies outside -7..7 or the input is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths -= 3
    if fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Fb', 'major'], None), (['B#', 'major'], None), (['Db', 'minor'], None)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['Fb', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['Gb', 'minor'], None), (['Db', 'minor'], None), (['G#', 'major'], None)], [(['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Fb', 'major'], None), (['B#', 'major'], None), (['Db', 'minor'], None)], [(['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['Fb', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in ('major', 'minor'):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths -= 3
    if fifths < -7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Fb', 'major'], None), (['B#', 'major'], None), (['Db', 'minor'], None)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['Fb', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['Gb', 'minor'], None), (['Db', 'minor'], None), (['G#', 'major'], None)], [(['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Fb', 'major'], None), (['B#', 'major'], None), (['Db', 'minor'], None)], [(['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['Fb', 'major'], None), (['E#', 'major'], None), (['Gb', 'minor'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Fb major and Db minor are reported as eight flats instead of being rejected.

Input [tonic, mode] with tonic a letter optionally followed by one # or b, and mode major or minor. The signature is the letter position on the line of fifths (F -1, C 0, G 1, D 2, A 3, E 4, B 5) plus 7 per sharp and minus 7 per flat; minor keys use the relative major, three fifths flatward. Return the count (positive sharps, negative flats) or None if it lies outside -7..7 or the input is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if not mode:
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths -= 3
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['C', 'dorian'], None), (['C', 'Major'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if not isinstance(mode, str):
        return None
    if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    rest = tonic[1:]
    if rest not in ('', '#', 'b'):
        return None
    acc = {'': 0, '#': 1, 'b': -1}[rest]
    fifths = base[tonic[0]] + 7 * acc
    if mode == 'minor':
        fifths -= 3
    if fifths < -7 or fifths > 7:
        return None
    return fifths
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['F#', 'major'], 6), (['Gb', 'major'], -6), (['C#', 'major'], 7), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['Cb', 'major'], -7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['C#', 'minor'], 4), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['C', 'dorian'], None), (['C', 'Major'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A dorian or capitalised Major request returns a major signature instead of None.

Input [tonic, mode] with tonic a letter optionally followed by one # or b, and mode major or minor. The signature is the letter position on the line of fifths (F -1, C 0, G 1, D 2, A 3, E 4, B 5) plus 7 per sharp and minus 7 per flat; minor keys use the relative major, three fifths flatward. Return the count (positive sharps, negative flats) or None if it lies outside -7..7 or the input is invalid.

split: open-access


prompt:
A sharp written in one measure still raises the same note after the barline, so F4 after | stays F#4 even in C major.

Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature is invalid.

split: open-access


prompt:
C#4 followed by C5 in the same measure plays C#5 although the accidental applies only to octave 4.

Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature is invalid.

split: open-access


prompt:
In G major, F4 after an explicit natural plays F#4 again because the natural mark (zero) is treated as absent.

Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature is invalid.

split: open-access


prompt:
In F major the note F4 is flattened instead of B4; every flat key signature alters the wrong letters.

Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature is invalid.

split: open-access


prompt:
Any passage containing a double flat such as Gbb4 or Bbb4 is rejected as invalid.

Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[-k:] + steps[:-k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter] + 6) % 12 - 6
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb'])], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B'])], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k + 1:] + steps[:k + 1]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter] + 6) % 12 - 6
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb'])], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B'])], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
D dorian is spelled with F# and C# because the step pattern is rotated right, yielding the locrian-side pattern order.

Input [tonic, mode]: tonic is a letter plus optional accidental from "", #, b, x, bb; mode is one of the seven church modes ionian..locrian. The step pattern is the major pattern 2 2 1 2 2 2 1 rotated left by the mode index. Each degree uses the next letter; its alteration is the pitch-class difference from the natural letter folded into -6..5. Return the seven names, or None if any alteration exceeds two or input is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter]) % 12
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Dx', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Dx', 'ionian'], None), (['D', 'major'], None), (['Abb', 'locrian'], None), (['H', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['Fb', 'locrian'], ['Fb', 'Gbb', 'Abb', 'Bbb', 'Cbb', 'Dbb', 'Ebb'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = pc - base[letter]
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Dx', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Dx', 'ionian'], None), (['D', 'major'], None), (['Abb', 'locrian'], None), (['H', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['Fb', 'locrian'], ['Fb', 'Gbb', 'Abb', 'Bbb', 'Cbb', 'Dbb', 'Ebb'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Every scale containing a flat degree returns None because a flat is folded to +11 and rejected.

Input [tonic, mode]: tonic is a letter plus optional accidental from "", #, b, x, bb; mode is one of the seven church modes ionian..locrian. The step pattern is the major pattern 2 2 1 2 2 2 1 rotated left by the mode index. Each degree uses the next letter; its alteration is the pitch-class difference from the natural letter folded into -6..5. Return the seven names, or None if any alteration exceeds two or input is invalid.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter] + 6) % 12 - 6
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += [2, 2, 1, 2, 2, 2, 1][li % 7]
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Cq', 'ionian'], None)], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter] + 6) % 12 - 6
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += steps[li % 7]
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Cq', 'ionian'], None)], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Non-ionian modes come out as the major scale of the tonic because the pitch advance follows the letter names.

Input [tonic, mode]: tonic is a letter plus optional accidental from "", #, b, x, bb; mode is one of the seven church modes ionian..locrian. The step pattern is the major pattern 2 2 1 2 2 2 1 rotated left by the mode index. Each degree uses the next letter; its alteration is the pitch-class difference from the natural letter folded into -6..5. Return the seven names, or None if any alteration exceeds two or input is invalid.

split: open-access


prompt:
Doubled notes such as [9,0,4,4,16] yield a normal form containing repeated pitch classes.

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

split: open-access


prompt:
Rotations that wrap past 11 produce negative spans, so a wrapped rotation such as [11,0,4] is never chosen correctly.

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

split: open-access


prompt:
Sets such as [0,1,5,6,8] and [0,1,3,5,8,9] get the left-packed normal form instead of the stipulated right-packed one.

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

split: open-access


prompt:
The augmented triad [0,4,8] returns [8,0,4] and the diminished seventh starts on 9.

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

split: open-access


prompt:
A wrapped normal form such as [11,0,4] is returned as [11,12,16].

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

split: open-access


prompt:
The major triad [0,4,7] keeps the prime form [0,4,7] instead of [0,3,7]: the less packed of the two candidates wins.

Input a list of integers. Compute the right-packed normal form of the set and of its inversion (p -> -p mod 12), transpose each to start on 0, and return whichever is more packed: compare the last value, then the penultimate, and so on toward the second (the original wins ties). Empty input returns []; non-integers return None.

split: open-access


prompt:
A major triad on D returns [2,6,9]-shaped values rather than [0,3,7].

Input a list of integers. Compute the right-packed normal form of the set and of its inversion (p -> -p mod 12), transpose each to start on 0, and return whichever is more packed: compare the last value, then the penultimate, and so on toward the second (the original wins ties). Empty input returns []; non-integers return None.

split: open-access


prompt:
Major and minor triads get different prime forms: [0,4,7] returns [0,4,7] instead of [0,3,7].

Input a list of integers. Compute the right-packed normal form of the set and of its inversion (p -> -p mod 12), transpose each to start on 0, and return whichever is more packed: compare the last value, then the penultimate, and so on toward the second (the original wins ties). Empty input returns []; non-integers return None.

split: open-access


prompt:
The empty set returns None instead of the empty prime form [].

Input a list of integers. Compute the right-packed normal form of the set and of its inversion (p -> -p mod 12), transpose each to start on 0, and return whichever is more packed: compare the last value, then the penultimate, and so on toward the second (the original wins ties). Empty input returns []; non-integers return None.

split: open-access


prompt:
A perfect fifth is counted as interval class 1 instead of 5, so [0,7] reports [1,0,0,0,0,0].

Input a list of integers, reduced mod 12 and deduplicated. For each unordered pair count its interval class min(d, 12-d) in 1..6. Return the six counts [ic1..ic6]; non-integer input returns None.

split: open-access


prompt:
Every interval is counted twice and each pitch class paired with itself lands in the tritone slot.

Input a list of integers, reduced mod 12 and deduplicated. For each unordered pair count its interval class min(d, 12-d) in 1..6. Return the six counts [ic1..ic6]; non-integer input returns None.

split: open-access


prompt:
A semitone is recorded in the ic2 slot and a major third in the ic4 slot.

Input a list of integers, reduced mod 12 and deduplicated. For each unordered pair count its interval class min(d, 12-d) in 1..6. Return the six counts [ic1..ic6]; non-integer input returns None.

split: open-access


prompt:
A set containing -1 is analysed as if it contained 1, so [-1,0,4] gets the wrong vector.

Input a list of integers, reduced mod 12 and deduplicated. For each unordered pair count its interval class min(d, 12-d) in 1..6. Return the six counts [ic1..ic6]; non-integer input returns None.

split: open-access


prompt:
A descending whole tone returns 9/10 instead of 8/9 and a descending tritone 45/64 instead of 32/45.

Input an integer semitone count (negative = descending). Ascending ratios use the table 1/1 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 per pitch class, times 2 per octave. A descending interval is the reciprocal of the ascending one of the same size. Return "p/q" in lowest terms (always with a denominator); non-integers and booleans return None.

split: open-access


prompt:
Every interval smaller than an octave returns 0/1 and a twelfth returns 3/1 only by coincidence.

Input an integer semitone count (negative = descending). Ascending ratios use the table 1/1 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 per pitch class, times 2 per octave. A descending interval is the reciprocal of the ascending one of the same size. Return "p/q" in lowest terms (always with a denominator); non-integers and booleans return None.

split: open-access


prompt:
The octave is returned as "2" and the double octave as "4" instead of "2/1" and "4/1".

Input an integer semitone count (negative = descending). Ascending ratios use the table 1/1 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 per pitch class, times 2 per octave. A descending interval is the reciprocal of the ascending one of the same size. Return "p/q" in lowest terms (always with a denominator); non-integers and booleans return None.

split: open-access


prompt:
Two fifths down returns 8/9 (below unison) instead of 16/9.

Input an integer k with |k| <= 24 (booleans rejected). Return (3/2)**k octave-reduced into [1, 2) as [numerator, denominator]; out-of-range or non-integer input returns None.

split: open-access


prompt:
One fifth down returns 3/2 instead of the fourth 4/3.

Input an integer k with |k| <= 24 (booleans rejected). Return (3/2)**k octave-reduced into [1, 2) as [numerator, denominator]; out-of-range or non-integer input returns None.

split: open-access


prompt:
A chain of -25 fifths is computed instead of being rejected as out of range.

Input an integer k with |k| <= 24 (booleans rejected). Return (3/2)**k octave-reduced into [1, 2) as [numerator, denominator]; out-of-range or non-integer input returns None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch + table[inst]
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72)], [(['F horn', 60, 'to_written'], 67), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['D trumpet', 60, 'to_concert'], 62), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['Bb clarinet', 127, 'to_written'], None)], [(['Eb alto sax', 60, 'to_written'], 69), (['piccolo', 72, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['A clarinet', 60, 'to_written'], 63)], [(['Bb tenor sax', 60, 'to_written'], 74), (['D trumpet', 62, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None), (['F horn', 126, 'to_written'], None)], [(['Bb clarinet', 60, 'to_written'], 62), (['piccolo', 72, 'to_written'], 60), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None), (['Bb clarinet', 127, 'to_written'], None), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None), (['oboe', 60, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - abs(table[inst])
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72)], [(['F horn', 60, 'to_written'], 67), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['D trumpet', 60, 'to_concert'], 62), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['Bb clarinet', 127, 'to_written'], None)], [(['Eb alto sax', 60, 'to_written'], 69), (['piccolo', 72, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['A clarinet', 60, 'to_written'], 63)], [(['Bb tenor sax', 60, 'to_written'], 74), (['D trumpet', 62, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None), (['F horn', 126, 'to_written'], None)], [(['Bb clarinet', 60, 'to_written'], 62), (['piccolo', 72, 'to_written'], 60), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None), (['Bb clarinet', 127, 'to_written'], None), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None), (['oboe', 60, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A concert C for Bb clarinet is written as Bb instead of D: the written part moves the same way as the sounding pitch.

Input [instrument, pitch, direction]. Each instrument has a stipulated sounding offset in semitones (concert = written + offset): Bb clarinet -2, A clarinet -3, F horn -7, Eb alto sax -9, Bb tenor sax -14, Eb baritone sax -21, guitar -12, piccolo +12, D trumpet +2, flute 0. direction to_concert adds the offset, to_written subtracts it. pitch and result must be MIDI 0..127; otherwise, or for unknown instrument or direction, return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -2, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 13, 'to_concert'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62)], [(['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -12, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 13, 'to_concert'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62)], [(['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 1, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Tenor saxophone parts are written a major second above concert instead of a major ninth.

Input [instrument, pitch, direction]. Each instrument has a stipulated sounding offset in semitones (concert = written + offset): Bb clarinet -2, A clarinet -3, F horn -7, Eb alto sax -9, Bb tenor sax -14, Eb baritone sax -21, guitar -12, piccolo +12, D trumpet +2, flute 0. direction to_concert adds the offset, to_written subtracts it. pitch and result must be MIDI 0..127; otherwise, or for unknown instrument or direction, return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb clarinet', 1, 'to_concert'], None), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb clarinet', 1, 'to_concert'], None), (['Bb tenor sax', 13, 'to_concert'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out < 0 or out >= 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb clarinet', 1, 'to_concert'], None), (['Bb tenor sax', 13, 'to_concert'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Bb clarinet', 1, 'to_concert'], None), (['Bb tenor sax', 13, 'to_concert'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['guitar', 0, 'to_concert'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Very low written notes for baritone saxophone return negative key numbers instead of None.

Input [instrument, pitch, direction]. Each instrument has a stipulated sounding offset in semitones (concert = written + offset): Bb clarinet -2, A clarinet -3, F horn -7, Eb alto sax -9, Bb tenor sax -14, Eb baritone sax -21, guitar -12, piccolo +12, D trumpet +2, flute 0. direction to_concert adds the offset, to_written subtracts it. pitch and result must be MIDI 0..127; otherwise, or for unknown instrument or direction, return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        out = pitch
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb clarinet', 60, 'sideways'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['Bb clarinet', 60, 'sideways'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['Bb clarinet', 60, 'sideways'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['Bb clarinet', 60, 'sideways'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 60, 'sideways'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        out = pitch + table[inst]
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb clarinet', 60, 'sideways'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['Bb clarinet', 60, 'sideways'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['Bb clarinet', 60, 'sideways'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['Bb clarinet', 60, 'sideways'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['piccolo', 120, 'to_concert'], None), (['Bb clarinet', 60, 'sideways'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An unrecognised direction such as "sideways" returns the input pitch instead of None.

Input [instrument, pitch, direction]. Each instrument has a stipulated sounding offset in semitones (concert = written + offset): Bb clarinet -2, A clarinet -3, F horn -7, Eb alto sax -9, Bb tenor sax -14, Eb baritone sax -21, guitar -12, piccolo +12, D trumpet +2, flute 0. direction to_concert adds the offset, to_written subtracts it. pitch and result must be MIDI 0..127; otherwise, or for unknown instrument or direction, return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not 0 <= pitch:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    table = {'Bb clarinet': -2, 'A clarinet': -3, 'F horn': -7, 'Eb alto sax': -9, 'Bb tenor sax': -14, 'Eb baritone sax': -21, 'guitar': -12, 'piccolo': 12, 'D trumpet': 2, 'flute': 0}
    if not isinstance(x, list) or len(x) != 3:
        return None
    inst, pitch, direction = x
    if inst not in table or not isinstance(pitch, int) or not pitch <= 127:
        return None
    if direction == 'to_concert':
        out = pitch + table[inst]
    elif direction == 'to_written':
        out = pitch - table[inst]
    else:
        return None
    if out < 0 or out > 127:
        return None
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['Bb clarinet', 62, 'to_concert'], 60), (['Bb clarinet', 60, 'to_written'], 62), (['F horn', 67, 'to_concert'], 60), (['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['F horn', 60, 'to_written'], 67), (['Eb alto sax', 69, 'to_concert'], 60), (['Eb alto sax', 60, 'to_written'], 69), (['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['Bb tenor sax', 74, 'to_concert'], 60), (['Bb tenor sax', 60, 'to_written'], 74), (['piccolo', 60, 'to_concert'], 72), (['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['piccolo', 72, 'to_written'], 60), (['D trumpet', 60, 'to_concert'], 62), (['D trumpet', 62, 'to_written'], 60), (['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)], [(['guitar', 64, 'to_concert'], 52), (['flute', 60, 'to_concert'], 60), (['flute', 60, 'to_written'], 60), (['flute', 127, 'to_concert'], 127), (['piccolo', 115, 'to_concert'], 127), (['Eb baritone sax', 10, 'to_concert'], None), (['Bb clarinet', 128, 'to_concert'], None), (['Bb clarinet', -1, 'to_written'], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An input pitch of 128 is converted (to 126 for Bb clarinet) instead of being rejected.

Input [instrument, pitch, direction]. Each instrument has a stipulated sounding offset in semitones (concert = written + offset): Bb clarinet -2, A clarinet -3, F horn -7, Eb alto sax -9, Bb tenor sax -14, Eb baritone sax -21, guitar -12, piccolo +12, D trumpet +2, flute 0. direction to_concert adds the offset, to_written subtracts it. pitch and result must be MIDI 0..127; otherwise, or for unknown instrument or direction, return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
        return None
    move = (5 * shift) % 12
    r = concert + move
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([0, 9], 3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 1], -5)], [([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([-7, 0], 5), ([0, 0], 0), ([0, -1], 5), ([0, 12], 0), ([8, 0], None)], [([-3, 2], -1), ([0, 3], -3), ([0, 7], 1), ([-2, 9], 1), ([8, 0], None), ([0, '2'], None), ([-8, 0], None), ([-9, 2], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 7], 1), ([0, 1], -5), ([3, -3], 6), ([-9, 2], None)], [([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([0, -1], 5), ([-5, 7], -4)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
        return None
    move = shift % 12
    r = concert + move
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([0, 9], 3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 1], -5)], [([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([-7, 0], 5), ([0, 0], 0), ([0, -1], 5), ([0, 12], 0), ([8, 0], None)], [([-3, 2], -1), ([0, 3], -3), ([0, 7], 1), ([-2, 9], 1), ([8, 0], None), ([0, '2'], None), ([-8, 0], None), ([-9, 2], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 7], 1), ([0, 1], -5), ([3, -3], 6), ([-9, 2], None)], [([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([0, -1], 5), ([-5, 7], -4)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A part written a whole step up from C major gets ten sharps-worth reduced to two flats instead of two sharps.

Input [concert_fifths, written_semitones_above_concert] with concert_fifths -7..7 and an integer semitone shift. The key moves by (7 * shift) mod 12 fifths; the written signature is concert_fifths plus that move, then normalised into -5..6 by adding or subtracting 12 (so six flats is written as six sharps). Invalid input returns None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
        return None
    move = (7 * shift) % 12
    r = concert + move
    r = r % 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([4, 2], 6), ([3, -3], 6)], [([-3, 2], -1), ([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([4, 2], 6), ([5, 2], -5), ([-6, 0], 6), ([-7, 0], 5)], [([0, 3], -3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 0], 0), ([2, -2], 0), ([0, -1], 5)], [([5, 2], -5), ([6, 0], 6), ([0, 1], -5), ([0, -1], 5), ([-2, 9], 1), ([3, -3], 6), ([0, 12], 0), ([8, 0], None)], [([4, 2], 6), ([7, 0], -5), ([3, -3], 6), ([8, 0], None), ([0, '2'], None), ([-5, 7], -4), ([6, 5], 5), ([-8, 0], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An F major part with no shift is written with eleven sharps instead of one flat.

Input [concert_fifths, written_semitones_above_concert] with concert_fifths -7..7 and an integer semitone shift. The key moves by (7 * shift) mod 12 fifths; the written signature is concert_fifths plus that move, then normalised into -5..6 by adding or subtracting 12 (so six flats is written as six sharps). Invalid input returns None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
        return None
    move = (7 * shift) % 12
    r = concert - move
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([4, 2], 6), ([-6, 0], 6), ([6, 0], 6), ([0, 0], 0), ([0, 12], 0), ([8, 0], None)], [([0, -2], -2), ([0, 9], 3), ([1, 2], 3), ([5, 2], -5), ([0, 12], 0), ([8, 0], None), ([0, '2'], None), ([-8, 0], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 3], -3), ([-1, 2], 1), ([7, 0], -5), ([-8, 0], None), ([-9, 2], None)], [([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([4, 2], 6), ([-7, 0], 5)], [([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([4, 2], 6), ([5, 2], -5), ([2, -2], 0)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
        return None
    move = (7 * shift) % 12
    r = move - concert
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([4, 2], 6), ([-6, 0], 6), ([6, 0], 6), ([0, 0], 0), ([0, 12], 0), ([8, 0], None)], [([0, -2], -2), ([0, 9], 3), ([1, 2], 3), ([5, 2], -5), ([0, 12], 0), ([8, 0], None), ([0, '2'], None), ([-8, 0], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 3], -3), ([-1, 2], 1), ([7, 0], -5), ([-8, 0], None), ([-9, 2], None)], [([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([4, 2], 6), ([-7, 0], 5)], [([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([4, 2], 6), ([5, 2], -5), ([2, -2], 0)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A Bb clarinet part (written a whole step up) for C major is given two flats instead of two sharps.

Input [concert_fifths, written_semitones_above_concert] with concert_fifths -7..7 and an integer semitone shift. The key moves by (7 * shift) mod 12 fifths; the written signature is concert_fifths plus that move, then normalised into -5..6 by adding or subtracting 12 (so six flats is written as six sharps). Invalid input returns None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert > 7:
        return None
    move = (7 * shift) % 12
    r = concert + move
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([8, 0], None), ([-8, 0], None)], [([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([8, 0], None), ([-9, 2], None)], [([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([4, 2], 6), ([5, 2], -5), ([-6, 0], 6), ([8, 0], None), ([-8, 0], None)], [([4, 2], 6), ([5, 2], -5), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([8, 0], None), ([-9, 2], None)], [([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 0], 0), ([2, -2], 0), ([0, 1], -5), ([8, 0], None), ([-8, 0], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or len(x) != 2:
        return None
    concert, shift = x
    if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7:
        return None
    move = (7 * shift) % 12
    r = concert + move
    while r > 6:
        r -= 12
    while r < -5:
        r += 12
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([8, 0], None), ([-8, 0], None)], [([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([8, 0], None), ([-9, 2], None)], [([0, 14], 2), ([1, 2], 3), ([-1, 2], 1), ([4, 2], 6), ([5, 2], -5), ([-6, 0], 6), ([8, 0], None), ([-8, 0], None)], [([4, 2], 6), ([5, 2], -5), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([8, 0], None), ([-9, 2], None)], [([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 0], 0), ([2, -2], 0), ([0, 1], -5), ([8, 0], None), ([-8, 0], None)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A concert signature of -8 flats is accepted and transposed instead of rejected.

Input [concert_fifths, written_semitones_above_concert] with concert_fifths -7..7 and an integer semitone shift. The key moves by (7 * shift) mod 12 fifths; the written signature is concert_fifths plus that move, then normalised into -5..6 by adding or subtracting 12 (so six flats is written as six sharps). Invalid input returns None.

split: open-access


prompt:
Bb, Ebmaj7 and every other flat-rooted symbol is rejected because the b is read as part of the quality.

Input a chord symbol: root letter with optional # or b, a quality from "", m, dim, aug, 7, maj7, m7, m7b5, dim7, sus4, mMaj7, 6, and optionally "/" plus a bass note (letter with optional # or b and nothing else). Return pitch classes root-first in template order; for a slash chord the bass moves to the front (removed from its old position if it is a chord tone, otherwise added). Unknown or malformed symbols return None.

split: open-access


prompt:
C/E returns [4,0,4,7] with the third listed twice instead of [4,0,7].

Input a chord symbol: root letter with optional # or b, a quality from "", m, dim, aug, 7, maj7, m7, m7b5, dim7, sus4, mMaj7, 6, and optionally "/" plus a bass note (letter with optional # or b and nothing else). Return pitch classes root-first in template order; for a slash chord the bass moves to the front (removed from its old position if it is a chord tone, otherwise added). Unknown or malformed symbols return None.

split: open-access