The purpose of this assignment is to learn to
ColorGrid
object.You will generate a visualization that looks like in the figure above.
In this assignment, the objective is to pull a song from Bridges, split the lyrics into individual words, and compare each word against every other word to check for repetition.
From these lyrics, you will be building a matrix, or a ColorGrid
in this case, where every row and
every column represents a sequential word in the song's lyrics.
Upon finding repetition, you will be setting the pixel at that location to a color of your choice at that point in the grid.
Bridges
for said Song
. For example Song mySong = Bridges.getSong("My Favorite Song", "Optional Artist String");
String lyrics = mySong.getLyrics();
Song mySong = DataSource::getSong("My Favorite Song", "Optional Artist String");
auto lyrics = mySong.getLyrics();
so = get_song("My Favorite Song", "Optional Artist String")
song = so.get_lyrics()
Pass these lyrics through the provided helper function, which will clean up and split the
lyrics into an array of squeaky clean String
s.
Initialize a ColorGrid
with the dimensions the size of the array returned from the helper function.
Iterate over the split lyrics array, checking to see if there is any repetition. For example, if word 1 is the same as the word 6, you would color the pixel at (1, 6), and later on at (6, 1).
After filling out your grid, set it as the data structure on your Bridges object, and run the code.