My high school, and many others implement a type of schedule called a Rotating Block Schedule. This is a way for people to have 8 classes, but on have 6 periods in a school day.
There are four days in a block schedule that repeat over and over, and have nothing to do with the actual days of the week. Each are assigned a number [1-4]
.
The way the schedule works is that you list all your morning classes, periods 1-4
: [1, 2, 3, 4]
. This is your schedule for the first day, or Day 1. The rest of the days just rotate the list: [2, 3, 4, 1]
, [3, 4, 1, 2]
, [4, 1, 2, 3]
.
However, the last period in the morning is "dropped" and you don't see that teacher that day. Hence the days are: [1, 2, 3]
, [2, 3, 4]
, [3, 4, 1]
, [4, 1, 2]
.
The afternoon is the same, except that it uses periods 5-8
instead: [5, 6, 7]
, [6, 7, 8]
, [7, 8, 5]
, [8, 5, 6]
.
Your task
All this rotating is hard to keep track of, so you have to write a program to print out my schedule given what day it is as input. Your code has to place Homeroom and Lunch in the correct spots. Here is the exact output your code needs to have for inputs 1-4
:
Homeroom Homeroom Homeroom Homeroom
Period 1 Period 2 Period 3 Period 4
Period 2 Period 3 Period 4 Period 1
Period 3 Period 4 Period 1 Period 2
Lunch Lunch Lunch Lunch
Period 5 Period 6 Period 7 Period 8
Period 6 Period 7 Period 8 Period 5
Period 7 Period 8 Period 5 Period 6
But Wait - One more thing!
Sometimes, on the first day of school, or on other special days, my school has a "Day 0". This just means that I will have all my classes that day along with homeroom and lunch. Your code will have to deal with Day 0's. Here is the output for a Day 0:
Homeroom
Period 1
Period 2
Period 3
Period 4
Lunch
Period 5
Period 6
Period 7
Period 8
This is code-golf so shortest code in bytes wins!
1, 2, 3, 5, 6, 7
? \$\endgroup\$