Your challenge is to take a note, such as G
, and output the note placed on a staff (in treble clef), like this:
- You must output a staff of alternating lines of
-----
(5 dashes) and a blank line. There will be 5 -----
s total. The note must be superimposed on top of this staff.
- The input will specify where the note is located. The input will be:
- an optional
H
or L
, specifying "high" or "low"
- a letter from
A
to G
, specifying the pitch
- an optional
#
or b
, specifying sharp or flat.
- The "note" is defined as:
- One
O
(capital O) aligned to the middle of the staff, which is in the place of the note. (The top line is HF
(high F), and the bottom line is E
(a normal E).)
- Three
|
s (vertical bars), the stem, which will be:
- one space to the left of the note and going downwards (starting one space below the note) if the note is on the middle line (
B
) or above, or
- one space to the right of the note and going upwards (starting one space above the note) if the note is below the middle line.
- A
#
or b
one space directly to the left of the note if specified in the input.
- Ledger lines must be added if the note is too high or low. These lines will be
---
(only 3 dashes in width, as opposed to 5) and will only appear if the note is on or above/below (for top/bottom ledger lines respectively) themthe ledger lines.