For this challenge, you need to print out the fingerings for various brass instruments.
The notes an instrument can play (as well as their fingerings) are listed below:
Cornet Baritone
Trumpet Bugle French Horn Euphonium Tuba
A#0 0
B0
C1 1234
C#1 134
D1 234
D#1 14
E1 24
F1 4
F#1 23
G1 12
G#1 1
A1 2
A#1 0 0
B1 123 1234 24
C2 13 134 4
C#2 23 234 23
D2 12 124 12
D#2 1 14 1
E2 2 24 2
F2 0 4 0
F#2 123 23 23
G2 13 12 12
G#2 23 1 1
A2 12 2 2
A#2 1 0 0
B2 2 24 12
C3 0 4 1
C#3 23 23 2
D3 12 12 0
D#3 1 1 1
E3 123 2 2 2
F3 13 0 0 0
F#3 23 12 23 23
G3 12 1 12 12
G#3 1 2 1 1
A3 2 0 2 2
A#3 0 1 0 0
B3 123 2 12 12
C4 13 0 1 1
C#4 23 23 2 2
D4 12 12 0 0
D#4 1 1 1 1
E4 2 2 2 2
F4 0 0 0 0
F#4 23 2 23 23
G4 12 0 0 12 12
G#4 1 2 1 1
A4 2 0 2 2
A#4 0 1 0 0
B4 12 2 12
C5 1 0 0 1
C#5 2 23 2
D5 0 12 0
D#5 1 1 1
E5 2 0 2 2
F5 0 0 0
F#5 23
G5 12 0
G#5 1
A5 2
A#5 0
Input
- A single string with a name of an instrument. You can assume the name will always be one of the 7 listed above.
- A note, which can be a single string or a string and integer. You can assume the note will match one of the notes listed above.
Output
- The fingering for the note on that instrument. This can either be a list of integers (one for each digit), or a single integer.
- If the instrument cannot play a given note (listed as blank above), return
"Impossible"
Test Cases
Cornet D#3 Impossible
Cornet E3 123
Trumpet G4 12
Trumpet B4 12
Trumpet F#5 23
Bugle F#5 Impossible
Bugle G5 0
Bugle G1 Impossible
French Horn B1 123
French Horn C3 0
French Horn E5 2
French Horn A#5 Impossible
Baritone A#5 Impossible
Baritone A#2 0
Baritone B2 24
Baritone B1 1234
Euphonium F2 4
Tuba A#0 0
Tuba B0 Impossible
Tuba C1 1234
Tuba B1 24
Tuba G#4 1
Tuba B4 Impossible
Notes
- Trumpet and Cornet have the same fingerings, as well as Baritone and Euphonium
- These ranges aren't comprehensive. I've tried to stick to the "standard" notes, but instruments can often go below (pedal notes) or above.
- The notes listed are in concert pitch
- You'll notice that there are a lot of patterns between the fingerings. Finding those patterns is critical to golfing this well.
This is a code-golf, so the shortest answer in your favorite language wins!