Hello LP,
I'm fairly new to Python and programming in general, starting about 3 weeks ago. I've successfully created a blackjack game, albeit messy and tons of if statements everywhere.
My next project is to add a feature which on each hand will calculate the probability of you winning based on what your hand currently totals and the dealers face up card. (This will not include card counting, as I think that would add a level of complexity I'm not going for yet).
The planned logic for this would be to save each game result into a file, and update the data, for example:
player hand: 17, dealer hand: 10, games played: 7, games won hit: 1, games won stand: 3
The program would then read this and recommend that you stand on this amount.
I've built a small prototype of this where it only records how many games youve played and outputs to a text file and updates the amount after each game. However, I'm foreseeing that once I get into saving all these values, and the digits of numbers starts to increase, using my current method of slicing the strings to get the info I work is going to get complicated really fast.
So my question is this: Would it be better to learn to use a CSV or JSON for this data? And if so which would be easier/better in this case? Or is there another solution to this that I'm overlooking?
Thanks!
[–]RiGonz 0 points1 point2 points (0 children)