So, someone recently asked me to make a schedule for them, and I agreed. When I sat down to do this, I realized that it was harder than I thought. This is just a schedule that allows you to move up to 4 people a day or night.
I thought of something like this:
for Monday to Saturday {
for(i=0;i<people.length;i++){
if (person[i].available()){
person.worksDay()
person is now not available.
}
}
for(i=0;i<people.length;i++){
if (person[i].available()){
person[i].worksNight()
person[i] is now not available.
}
}
}
Thus, the idea of this algorithm is that for each day a person is assigned a day or night shift. A person is available if they DID NOT SELL work shift, and they are not on vacation. It is from Monday to Saturday. As you can probably say, given that people A, B, C, D will look like this (if no one is on holidays):
Mon A B
Tue C D
Wed A B
Th C D
Fri A B
Sat C D
, , . , , . , , ? , ?