Liam, this is incredible ! I thought it might be useful for you to incrementally see how someone in industry would review or change this code, so here's a little code review via video: https://youtu.be/UkVOrcS--04 We very incrementally build up to the final code, which can be found here: https://gist.github.com/stevekrenzel/b490564bf1c7f98e232a6c8... Hope you find it helpful!
Thanks Steve! I watched your video and although I don't understand everything, I learned a lot. Separating my program into functions is a good idea. Your video clarified the map function for me. Through your video, I understood that I was running code multiple times, when it only needs to run once (how I parsed my rules was one of these instances that you went over in your video), so thanks for pointing that out. Aga…
Liam -- this response is just as impressive as the code that you wrote. You're obviously very smart, but that isn't good enough on its own. I've seen very-smart people who aren't open to critique, who get defensive rather than take the opportunity to learn new things. They don't get very far in life. On the other hand, the attitude you're showing here is tremendously valuable, and will serve you incredibly well throughout life. Never let yourself grow out of it!