It's finally working! It works on 12 of the 35 test cases! Woohoo!
Reminder to myself to work on cases 14, 18, 13, 17, and 11 tomorrow. If I can get these working, my estimated grade will go up to 74%, which I'm fairly sure will be above average.