Actually, I already solved how to win. I did that quite easily yesterday after a brief conversation with my brother, but then today, when i decided to test winning, I realized that i never passed any arguments to my isWin() function or even the getWinningTriplet() function. Instead I simply looped through every possible win scenario and checked for met requirements. How do i test if this works other than trying it or i suppose creating a simulation, but then that means that testing any future algorithm is going to require just as much complexity–or maybe it’s not complex, and I’m just too novice.
Regardless, i felt that the getWinningTriplet() function should have the most recent boxPlayed fed to it, and then it should check the appropriate boxes to confirm a win. This way, something in the game actually “knows” what’s going on. Otherwise, there’s no control and it’s just checking periodically or upon an event if set requirements have been met. I don’t know, maybe there’s nothing wrong with this, but I feel like it’s lazy. Like whenever it’s not checking for a win, it can take a nap during the game or go fishing instead of keeping track of what’s going on in the game and knowing that a win could happen. Perhaps a better metaphor in real life for me is that instead of knowing beforehand that closing this.valve will for certain shut down the plant, my program is waiting for the valve to be closed and then checking to see “Ohp! Yup! That valve shut down the plant!” Can you imagine if we ran our chemical plants like that. Let’s just wait and see.
Anyway, it doesn’t feel good to me the way I have it, so i set forth on changing it! That’s when I got stuck and ran in circles for three hours–not because it’s hard, but just because i don’t want to write 23 different if statements. I know that there is a better way; I just don’t know what it is or how to get there… And so I’m frustrated.
I’ll reach out for help tomorrow… Or maybe it’ll come to me in my sleep…
Rex:
Last night, Rex did not want to go to bed, but all of a sudden he got off the couch and said, “Mom! Come on!” “Where are we going Rex?” “Weeya going to my room and to my bed.” “Are you going to bed?” “It’s bedtime.” And sure enough, he walked me hand-in-hand to his bed, got into bed, and made no fuss. So it’s either fluke or something amazing–i guess we’ll learn tonight. And of course, this morning was no different than any other morning, “mom, i neeed a dooohnut!”
Leo:
Hmm Leo… He was cute this morning as he was climbing all over me & Rex, and would not leave us alone. Oh, and this kid loves beans!!