Important: The deadline for this event has passed. Solutions are available in VBScript, Windows PowerShell, and Perl. |
In Making Beautiful Music, competitors must write a script that can compile a music playlist listing songs to be burnt to a CD.
Not a native speaker of English? These event instructions are also available in the following languages: Chinese (Simplified); Chinese (Traditional); French; German; Japanese; Portuguese Brazilian; Russian; and Spanish. For more information, and to access these localized instructions, see the Scripting Games International page.
| About This Event | |
| Event Scenario |
Division | Advanced |
Deadline | Thursday, February 28, 2008 (8:00 AM PST) |
Points Awarded | 15 |
Digital music players are undoubtedly the wave of the future, but the future isn’t quite here yet; therefore, many people still like to “burn” their digital music files to CDs. The burning process is quite easy; the hard part is trying to figure out which songs to put on a single CD, and how many songs you can put on a single CD. But that should no longer be a problem for you, not if you are able to come up with a solution for Event 8 in the Advanced Division.
For this event, you’ll be given a text file (SongList.csv, found in the Scripting Games Competitors’ Pack) containing information about a number of digital music files; each line in the text file consists of an artist name, a song title, and a song length (in the format minutes:seconds). For example:
The Beatles,Rocky Raccoon,3:41 The Beatles,Honey Pie,2:41 The Beatles,I Saw Her Standing There,2:56
Your job is to use the information in that text file to create a playlist of songs that (in theory, at least) will eventually be burned to a music CD.
Note. You just need to create the playlist; you don’t have to actually burn the songs to a CD. Nor do we want you to actually burn songs to a CD; our testing process would end up taking forever if we did. |
So is there a catch here? As a matter of fact, there are a couple catches here. For one, we need to optimize the amount of music that appears on the playlist; consequently, the total music time must be at least 75 minutes but no greater than 80 minutes. In other words, if the length of all the songs on your playlist adds up to 82 minutes and 45 seconds, well, then you won’t get credit for this event.
For another, your playlist can only include, at most, two songs by a single artist. If your playlist already includes Rocky Raccoon and Honey Pie by the Beatles, then you can’t add another Beatles song; if you do, your entry will be disqualified. Two songs per artist, tops.
Needless to say, there are a number of possible solutions to this event. That means that there is no need to get the solution; after all, there’s no such thing as the solution. Just make sure you create (and display) a list of songs as well as the total music time. For example:
The Beatles Rocky Raccoon 3:41 The Beatles Honey Pie 2:41 Total music time: 6:22
Of course, this example would fail because the total music time is less than 75 minutes. But you get the idea.
To successfully complete this event, place the file SongList.csv in the folder C:\Scripts; if your script uses any folder other than C:\Scripts it will likely fail. The script should report back the name of the artist, the name of the song, and the length of the song in the format m:ss, where m represents the number of minutes and ss represents the number of seconds. Note that seconds must be reported using two digits; for example, a song length of 3 minutes and 9 second must be displayed like this:
3:09
At the end of the list, you must then report the total disc time, also using the format m:ss. Remember the total time must be greater than or equal to 75 minutes, but less than or equal to 80 minutes.
Oh: and you also need to sort the playlist alphabetically by artist name; that makes it easier for us to verify that the playlist does not contain more than two songs by any one artist. Here’s an example of the type of output your script should display:
Alice Cooper I'm Eighteen 2:58 Badfinger Carry On Til Tomorrow 4:49 Badfinger Day After Day 3:11 Credence Clearwater Revival Have You Ever Seen the Rain? 2:39 Dire Straits Walk of Life 4:12 Donovan Catch the Wind 5:02 George Harrison What is Life? 4:27 Jefferson Airplane White Rabbit 2:34 Nick Cave and the Bad Seeds Henry Lee 3:56 Nirvana All Apologies 3:50 Nirvana Heart-Shaped Box 4:41 Paul Simon Mother and Child Reunion 2:48 Robert Palmer Simply Irresistible 4:12 The Animals House of the Rising Sun 4:31 The Bangles Manic Monday 3:06 The Beatles Back in the USSR 2:43 The Beatles Honey Pie 2:41 The Kinks Lola 4:05 The Ramones I Wanna Be Sedated 2:29 The Rolling Stones Anybody Seen My Baby? 4:07 The Rolling Stones It's Only Rock and Roll 4:10 Total music time: 77:11
Good luck!