Day 19: Blackjack Splitting

May 9, 2017

by — Posted in Coding

I’ve got some thorough testing to complete, but I think I have splitting cards done!

That was a tough feature for me to complete because it required me to rethink and redesign my data structures, and then I had to make sure all of my previously written code worked with said new data structures.  I can better appreciate now why my dev team gets annoyed with later features that require them to change how things were previously implemented.  It not only requires making the changes but then testing all around those changes (which, in some cases means testing the whole app) just to be sure it still works as it’s supposed to. 

Some lessons:

  • Make sure each function does just one thing if at all possible.  Some of my code was getting messed up because I was trying to basically process hands at different times, which meant some steps were referencing the wrong hand to process.  
  • Default values in arguments are my friend. I never had to use them really until now, but they have come in very handy for being able to run functions on edge cases (i.e. different hands if players split their cards). 

Leave a Reply

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