I’m pretty sure there’s a bug with the way subjects and their grades are handled.
<<if $StudiedQuizC1 is 0 or $StudiedQuizC2 is 0>>
...
<<elseif $StudiedQuizC1 is 1 or $StudiedQuizC2 is 1>>
...
<<elseif $StudiedQuizC1 is 2 or $StudiedQuizC2 is 2>>
...
<<elseif $StudiedQuizC1 gte 3 or $StudiedQuizC2 gte 3>>
is common to each of the subjects. Let’s suppose that $C1Q1 has been assigned the value "Biology" (for the sake of argument), and $C2Q1 has been assigned the value of "Calculus".
Suppose our heroine failed to study for calculus (so $StudiedQuizC2 is 0), and studied hard for biology (so $StudiedQuizC1 is 3). When we evaluate each of the parts in order:
Is $StudiedQuizC1 is 0 or $StudiedQuizC2 is 0 true? => Is $StudiedQuizC1 is 0 true? => true. (or only evaluates as much as is necessary). This is true independent of whether we’re looking at Calculus or at the Biology Quiz passage.
Stylistically, I think the right thing here is to make the subjects objects in a datamap, and actually turn the whole thing into a macro that takes a subject object (with all of the attributes about the subject). This is one of the advantages of Sugarcube over Harlowe - that abstraction is not available to you in Harlowe.
Something like the following: (edit 4 - made the code below consistent in style with the style I later adopted):
<<widget "doQuiz">>
You sit down to take the quiz.
<<set _s = $Subjects[_args[0]]>>
<<if _s.StudiedQuiz is 0>>\
You tried your best but you really didn't study enough. You turn it in and it is quickly graded by the TA. They hand it back to you and you see you failed.
<<elseif _s.StudiedQuiz is 1>>\
You did what you could with what little you studied. You thought you knew enough to get most of them right. You turn it in to the TA who quickly grades it for you. They hand it back to you to see you got a C!
<<set _s.Grade += 1>>
<<elseif _s.StudiedQuiz is 2>>\
You studied plenty to have a decent grasp on the material. You were able to quickly get through most questions though a couple stumped you. You turn it in to the TA who quickly grades it. They hand it back to you. You see you got a B!
<<set _s.Grade += 2>>
<<elseif _s.StudiedQuiz gte 3>>\
You knew all this hands down. You studied more than you think most people would expect anyone to. You quickly nail all the questions and walk up to the TA to hand it in. They quickly grade it with a slight grin on their face. They hand it back to you. You see you received an A!
<<set _s.Grade += 3>>
<</if>>
<<set _s.Class = 1>>\
<<set _s.StudiedQuiz = 0>>\
<<set _s.DaysTillQuiz = 5>>\
<<set $Time to $Time +1>>\
<</widget>>
(add that to a new passage with the tag “widget”, per the Sugarcube documentation on widgets).
Then in the StoryInit passage, add:
<<set $Subjects = {}>>
<<for _i, _s range ["Biology", "English", "History", "Calculus"]>>
<<set $Subjects[_s] = {
"Class": 0,
"DaysTillQuiz": 5,
"Grade": 0,
"Name": _s,
"StudiedQuiz": 0,
"Topic": 0,
}>>
<</for>>
And (probably?) in the Schedule passage, I’d do:
<<set $Studies = [$C1Q1, $C2Q1]>>
and in Transition 1 and 2:
<<goto $Studies[0]>>
and
<<goto $Studies[1]>>
In each of the subject passages, then (e.g. Biology):
<<set _s = $Subjects["Biology"]>>
and replace “$Biology” throughout with _s. (including the .).
In order to fully do the refactor, I’d also add the following widgets:
<<widget "gradeHW">>
<<set _s = $Subjects[_args[0]]>>\
<<if _s.Homework is "Complete">>\
You turned in your homework and the TA graded it.
<<set _s.Grade += 1>>\
<<else>>\
You did not complete your homework and thus could not turn it in.
<</if>>\
<</widget>>
<<widget "assignHW">>
<<set _s = $Subjects[_args[0]]>>\
<<set _s.Homework to _args[0] + " Homework">>\
You were assigned _args[0] Homework to complete this evening.
<<set _s.DaysTillQuiz -= 1>>\
<</widget>>
<<widget "quizInfo">>
<<set _s = $Subjects[_args[0]]>>\
<<if _s.DaysTillQuiz gt 1>>\
Your next quiz is coming at the end of the week!
<<else>>\
Your next quiz is tomorrow! _args[1] reminds you to study hard tonight.
<<set _s.Class to 2>>\
<</if>>\
<</widget>>
Each of the Bio passages then become something like:
Begin Biology:
<<gradeHW "Biology">>
Dr. Garza lectured on biological topics.
<<include "Biology Events 1">>
<<assignHW "Biology">>
<<quizInfo "Biology" "Dr. Garza">>
<<set $Time to $Time +1>>\
[[Finish Class]]
Biology Quiz:
<<doQuiz "Biology">>
<<set $Time to $Time +1>>\
[[Finish Class]]
Begin Biology Class:
(remove all the superfluous C1Q1 logic, and just have the following at the top)
<<set _s = $Subjects["Biology"]>>\
<<set _s.Class to 1>>\
<<set _s.Homework to "Biology Homework">>\
<<set _s.DaysTillQuiz to 4>>\
and in Biology itself:
at the top (and in each of the elseif clauses, just replace the expression in the same way as the if):
<<set _s = $Subjects["Biology"]>>
<<if _s.Class is 0>>
A similar adjustment is needed where studying occurs (which I’ll write shortly).

