Hello! I have tried to apply the concepts taught at the CS 101 course and the code is here:
#defining general tasks to be completed
#how blackjack works
#goal: having a hand that totals higher than the dealers without going over 21
#if a player hand totals higher than 21, he busts and loses his bet
#game flow
#the dealer deals 1 open card to everyone, including himself
#the dealer then deals another open card to everyone but himself, then deals a closed card to himself
#if a player hits a blackjack on opening hand they are awarded 1.5 times their bet(if they bet 1 they get 2.5 in return)
#each player(in the case of this game, only 1), in their turn, going counter-clockwise from the dealer(if there are more than 2 players)
#can decide to do one of each actions:
#hit - the player asks for another card
#stay - the player ends their turn
#double down - doubles their bet, a hit and a stay.
#basic game flow
#players place bets
#dealer deals cards
#players take their turns
#dealer takes their turn
from random import shuffle
This file has been truncated. show original
and the blog post is this:
What are your thoughts?
thanks!
Just downloaded the game and it is really good. I never new you could clear the screen for the user, I will have to add that to my game I created.
1 Like
Thank you!
Although the way I did it only works for windows users :P, i don’t know why I didn’t make it work for linux also as it was only 2 more lines of code haha