96 lines
3.6 KiB
Go
96 lines
3.6 KiB
Go
package twelve
|
|
|
|
const testVersion = 1
|
|
|
|
func Song() string {
|
|
var ret string
|
|
for i := 1; i <= 12; i++ {
|
|
ret += Verse(i) + "\n"
|
|
}
|
|
return ret
|
|
}
|
|
|
|
func Verse(i int) string {
|
|
ret := "On the " + intToOrd(i) + " day of Christmas my true love gave to me, "
|
|
if i >= 12 {
|
|
ret += "twelve Drummers Drumming, "
|
|
}
|
|
if i >= 11 {
|
|
ret += "eleven Pipers Piping, "
|
|
}
|
|
if i >= 10 {
|
|
ret += "ten Lords-a-Leaping, "
|
|
}
|
|
if i >= 9 {
|
|
ret += "nine Ladies Dancing, "
|
|
}
|
|
if i >= 8 {
|
|
ret += "eight Maids-a-Milking, "
|
|
}
|
|
if i >= 7 {
|
|
ret += "seven Swans-a-Swimming, "
|
|
}
|
|
if i >= 6 {
|
|
ret += "six Geese-a-Laying, "
|
|
}
|
|
if i >= 5 {
|
|
ret += "five Gold Rings, "
|
|
}
|
|
if i >= 4 {
|
|
ret += "four Calling Birds, "
|
|
}
|
|
if i >= 3 {
|
|
ret += "three French Hens, "
|
|
}
|
|
if i >= 2 {
|
|
ret += "two Turtle Doves, and "
|
|
}
|
|
|
|
return ret + "a Partridge in a Pear Tree."
|
|
}
|
|
|
|
func intToOrd(i int) string {
|
|
switch i {
|
|
case 1:
|
|
return "first"
|
|
case 2:
|
|
return "second"
|
|
case 3:
|
|
return "third"
|
|
case 4:
|
|
return "fourth"
|
|
case 5:
|
|
return "fifth"
|
|
case 6:
|
|
return "sixth"
|
|
case 7:
|
|
return "seventh"
|
|
case 8:
|
|
return "eighth"
|
|
case 9:
|
|
return "ninth"
|
|
case 10:
|
|
return "tenth"
|
|
case 11:
|
|
return "eleventh"
|
|
case 12:
|
|
return "twelfth"
|
|
}
|
|
return ""
|
|
}
|
|
|
|
/*
|
|
{1, "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree."},
|
|
{2, "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{3, "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{4, "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{5, "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{6, "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{7, "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{8, "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{9, "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{10, "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{11, "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
{12, "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."},
|
|
*/
|