- May 23, 2023
- 182
- 87
Yeah, but it's already a patch.I think you missunderstood something about the 'fakeExam' var. 'fakeExam' IS designed to be check during exams, that's the entire purpose of that var
The problem is 'exam' and 'fake exam' aren't variations of the same logic path. They're two interpenetrating paths that you have to repeatedly resort to variations of 'fakeExam' to try to keep untangled. The more you develop them the more they'll tangle and the more you'll have to add 'fakeExam' checks to patch the resultant bugs.
If you want to be as parsimonious with code as possible and still have something maintainable and upgradeable what you should do is this (assuming you've still got your head around the exam/fake exam code).
1. Go through the entire exam logic path identifying the bits that operate in exactly the same way whether or not the exam is fake.
2. Think about whether they might have divergent development streams in future (e.g. does it make sense for a student to comply with Academy dress regulations in her own bedroom? for a fake exam to continue late into the night with a hostile mother in the house? can a student really graduate from her own bedroom?).
3. If you're pretty sure they're the same and will stay that way, hive them off into separate modules. Functions when possible, subroutines and screens when necessary.
4. Once you've gutted the exam/fake exam code of what both logic paths really have in common, use what's left as a basis for two separate top level control flows, one 'exam' one 'fake exam', both using the modules they have in common. If you do it right 'fakeExam' will be completely redundant and you won't end up writing as much new code trying to keep them untangled as you'd reuse old code by combining them. Use calls to your modules as much as possible with jumps only as a last resort. What you definitely don't want is to have global 'fakeExam' invading class level functions like attemptAnswer(). Have the control flows call it separately then use returned values to decide at the control level whether a girl passed or whether to increment the .examFlewWeek counter.
You'll end up with something easier to maintain, easier to develop and ultimately more elegant and concise than the pasta disaster you seem to be heading for. What's more you'll have a library of stand-alone exam modules you can use if you later decide to use an 'exam-like' scenario somewhere else in the game. And the extra work you do now will save you a lot more work later.
Last edited: