First the program prints the ribbon.
Then all needed characters can be found in "-+ !". Depending on x and y the correct character is chosen. The sinus function will create a sequence, where each 9th number is 1 and all others are 0. int(j/9) will be a whole number every 9th entry.