SquigglyFrogStudios

Rewrite rewritten!

Amid all the distractions last night, not the least of which was standing in line for several hours to vote, I did manage to get some coding time in and made significant progress on Scratch’n Score, eliminating the issues with the old codebase.

It took a couple days to truly get over it and delete the old code completely and rewrite it. I know I’m stubborn, but I backed up the two files thinking to use them as a reference, but the problem came when I kept going to them, trying to just copy and paste to fix it, rather than doing what I had intended, a rewrite.

Once I was able to get my brain to cooperate, and after several heated internal arguments with myself, I convinced all those nagging thoughts that a rewrite, from scratch, was the better way to attack this. And the result? A lovely dice rolling simulator, that lets you roll until you scratch, or until you score your points and pass the dice to the next player. I amended the score calculating code to keep track of which dice in a roll were contributing to the score to eliminate players trying to cheat…

For example, you roll and 5 of your dice are scoring, but that last one wasn’t. Well, you could cheat the system by just selecting all 6 and then boom, next roll it would think you scored with all 6 and let you reroll 6, instead of one. Not anymore. As a matter of fact, I think it’s going to be a default ‘house rule’ that if you try to include a non-scoring die in your take, it will be an instant scratch..

The rewrite also allowed me to handle some other things that would have been harder with the old code like having wild dice where if you’re lucky you could change one of the die values to anything you want, among other variations.

In the long run, this was worth it, but painful. I hate doing a complete rewrite as I feel like I have just wasted all that time, but it was worth it. Hopefully this weekend I’ll get back to the code and finish up the gameplay portion. Time will tell!

Leave a Reply

Your email address will not be published. Required fields are marked *