Given a list of chords label them as either 'Major' or ' Minor'.
Input will be a list of chords, one per line, made up of 3 notes separated by a space. Each note will consist of the note name in uppercase (
G) and an optional accidental (
b). Chords may be in any inversion (i.e. the notes may be in any order).
If the chord is major, output 'Major'. If the chord is minor, output 'Minor'. If the chord is neither major nor minor, output a blank line.
C E G F Ab C C Eb Gb E G B Db F Ab Bb G D D A Gb
Major Minor Minor Major Minor Major
As in some of my past questions, I've once again butchered some test scripts originally created by Joey and Ventero to provide some test cases for this question:
./test [your program and its arguments]
Each entry which I can verify that meets the spec, passes the tests and has obviously had some attempt at golfing will receive an upvote from me (so please provide usage instructions with your answer). The shortest solution by the end of 13/10/2012 will be accepted as the winner.
A little theory
For those of you with no musical theory knowledge here's enough information for you to be able to compete.
A major or minor chord is made up of three notes which are separated by a specific pattern of semitones. If we consider the root (bottom note) of the chord to be 0, then a major chord is the pattern 0-4-7 and a minor chord is the pattern 0-3-7. Things are made more awkward by the fact that some notes are a semitone apart and some are a tone apart. The spread of semitones from
G# is as follows:
G#/Ab A A#/Bb B/Cb B#/C C#/Db D D#/Eb E/Fb E#/F F#/Gb G G#/Ab 0 1 2 3 4 5 6 7 8 9 10 11 12
G#/Ab means that that
G# is the same note as
Ab. From this we can see that the chord
Ab C Eb is a major chord, and that
Ab Cb Eb is minor.
To complicate matters further, the chord
Eb Cb Ab is considered to be the same as
Ab Cb Eb,
Cb Eb Ab and
Cb Ab Eb and so on. Every one of these variations is still a minor chord.