Here is a possible alternative which avoids my above complaint. This would treat the reserve gear just like any other teleop gear. Let's call Brian's original pseudocode Option 1, and this pseudocode Option 2.
Code:
function matchTotalGears(match):
if match.rotor4Engaged: return 13
if match.rotor3Engaged: return 7
if match.rotor2Engaged: return 3
else: return 1
function matchAutoGears(match):
if match.rotor2Auto: return 3
if match.rotor1Auto: return 1
else: return 0
function matchTeleopGears(match):
return matchTotalGears(match) - matchAutoGears(match)