This is an implementation of a scale exercise widely used in jazz teaching. It's sometimes known as the "big scale" exercise.
Let's say you practice the saxophone and you want to make sure you know all your major scales. One way to test this would be to play the scale within the limits of your instrument - saxophones have a lowest note and a highest note (from :Db3 to :A5 at concert pitch in Sonic-Pi speak - see here http://en.wikipedia.org/wiki/Alto_saxophone#Range - assuming you don't get fancy with harmonics!)
Playing an Eb major scale over the whole range of the instrument would mean playing from :D3 to Ab5 (concert) as the lowest and highest notes available don't appear in the scale (:Db3 and :A5 respectively). When you hit the upper or lower limit you just reverse the direction and carry on going.
Typically, you play a set number of bars for each scale - in this example it's 4 bars. On the next four bars you switch to the nearest available note in the new scale, indicated in the list shown in the output window.
This exercise really keeps you on your toes! It takes a lot of practice to make sure your fingers naturally shift to the next scale pattern and it's good training for switching up scales in jazz improvisation.
The problem with the guitar is that the range of the instrument is huge - :E2 to :B6! The added problem is that there are a million different fingering patterns to navigate between those notes because the same notes appear on different strings (not like a piano or a saxophone (for the most part) where each note occurs in one place).
One solution - take the range as being the most your fingers can play in one position. In the example below, that means using frets 1 - 5 with no open strings which should give a range of :F2 to :A4
If you can play all the scales without moving position that will give you 12 "shapes" that will let you switch between any scales anywhere on the guitar. It's very liberating when you get used to it!
I was taught this exercise by Mike Walker who is one of the greatest jazz guitarists alive today. He's an excellent teacher and he's put together an instructional site called Practisin2Play which describes this exercise and hundreds of others - well worth a look for anyone into jazz guitar!