This is a somewhat clunky version of a Blackjack simulatation implemented in matlab that I created for a school project in 2016. I plan to translate it and clean it up in python/R eventually.
The main point of the analysis was to determine an optimal betting strategy to implement when counting cards in blackjack (ex: at what count should you increase your bet? how much should you increase it?) There is a main paper that describes the methodolgy and the results of the analysis. Appendix B acts as the main documentation runs through each of the MATLAB files and functions and what they do.
Moral of the story is you probably shouldn't play blackjack even if you are a master at counting cards.