24
5
Write the shortest program that generates guitar tabs for the chords given as input.
So that the guitarists among you don't have an advantage, and to make it deterministic (and probably easier to code), here are the only forms of the chords authorized:
Major chords:
E F F# G G# A A# B C C# D D#
e 0---1---2---3---4---0---1---2---3---4---5---6---
B 0---1---2---3---4---2---3---4---5---6---7---8---
G 1---2---3---4---5---2---3---4---5---6---7---8---
D 2---3---4---5---6---2---3---4---5---6---7---8---
A 2---3---4---5---6---0---1---2---3---4---5---6---
E 0---1---2---3---4---0---1---2---3---4---5---6---
Minor chords:
Em Fm F#m Gm G#m Am A#m Bm Cm C#m Dm D#m
e 0---1---2---3---4---0---1---2---3---4---5---6---
B 0---1---2---3---4---1---2---3---4---5---6---7---
G 0---1---2---3---4---2---3---4---5---6---7---8---
D 2---3---4---5---6---2---3---4---5---6---7---8---
A 2---3---4---5---6---0---1---2---3---4---5---6---
E 0---1---2---3---4---0---1---2---3---4---5---6---
Note that the 5 first chords and the 7 last chords of each series have different forms.
All the chords are simple major or minor chords (no 7th or other variations).
You should take care of flats too. Reminder:
A# = Bb
C# = Db
D# = Eb
F# = Gb
G# = Ab
B#, Cb, E# and Fb are not used
Output must include the first column with the cord names, as shown above. It does not have to include the chord name on top. Chords must be separated by 3 -
as shown above. The final 3 -
are optional.
Input is a string consisting of chord names, separated by spaces.
An example input is:
Bm Gb A E G D Em F#
and the corresponding output is:
e 2---2---0---0---3---5---0---2---
B 3---2---2---0---3---7---0---2---
G 4---3---2---1---4---7---0---3---
D 4---4---2---2---5---7---2---4---
A 2---4---0---2---5---5---2---4---
E 2---2---0---0---3---5---0---2---
... and side question: what's the example song? :) – Jules Olléon – 2011-06-23T20:55:44.567
5Hotel California :P – Matthew Read – 2011-06-23T21:16:08.573
Yep, you win! :) – Jules Olléon – 2011-06-23T21:41:43.857
Cool idea. Wish I had time to play! – Igby Largeman – 2011-06-29T00:26:27.987