sequence card game

 import random

dict = {'A':4,'KING':4,'QUEEN':4, 'J':4, '10':4, '9':4, '8':4,'7':4,'6':4,'5':4,'4':4,'3':4,'2':4}

ROWS = 3
COLS = 3



def sequence_game(alhp,rows,cols):
    all_cards = []
    for i, dict in alhp.items():
        for _ in range(dict):
            all_cards.append(i)
    user_input = input("do you want to play ? ")
    if user_input == 'y':
        print(f"all_cards : {all_cards}")
    while True:
     
     bet_amount_input = (input("how much amount you want to bet ? $ "))
     bet_amount = 0
     
 
   
     if bet_amount_input.isdigit():
      bet_amount = int(bet_amount_input)
      if bet_amount > 0:
        print("okay lets start")
     
       
      else:
        print("bet amount must be greater than 0")


 
     random_choice = []
 
   
     for col in range(cols):
      value = random.choice(all_cards)
      all_cards.remove(value)
     
      random_choice.append(value)
     
     
   

     lets_distribute_all_cards = input(" ready to distribute ? ")
     if lets_distribute_all_cards == 'y':
       
       
        print(random_choice)
     elif lets_distribute_all_cards == 'q':
       exit()  
     if random_choice[0]==random_choice[1]==random_choice[2]:
      print(f"congratulations you won {bet_amount*10}$")
     elif (random_choice[0]==random_choice[1]!=random_choice[2] or
         random_choice[0]!=random_choice[1]==random_choice[2]) or (random_choice[0] ==
random_choice[2] != random_choice[1]):
      print(f"your score is 10,you won {bet_amount*2}$")
       
     
     elif set(random_choice) =={'A', 'KING','QUEEN'}:
      print(f"congratulations!,you got a high run, your score is 7, you won {bet_amount*9}$")
     elif set(random_choice) == {'A','2','3'}:
      print(f"congratulations!,you got a 2nd high run, your score is 6, you have won {bet_amount*8}$")
     elif set(random_choice) == {'KING','QUEEN','J'}:
      print(f"congratulations,you got 3rd high run, your score is 5, you have won {bet_amount*7}$")
     elif set(random_choice) == {'QUEEN','J','10'}:
      print (f"congratulations,you got 4th high run, your score is 4, you have won {bet_amount*6}$")
     elif set(random_choice) == {'J','10','9'}:
      print(f"congracts,you got 5th high run, your score is 3 you have won {bet_amount*5}$")
     elif set(random_choice) == {'10','9','8'}:
      print(f"congratulations,you got 6th high run, your score is 2 you have won {bet_amount*4}$")
     elif set(random_choice) == {'9','8','7'}:
      print(f"congratulations,you got 7th high run,your score is 1, you have won {bet_amount*3}$")
   
   

     
   
   
   
     
     
                                   
     
   
                                     
   
     
   
     else:
      print(f"sorry! you have lost {bet_amount}$ , lets try again")
   
   

sequence_game(dict,ROWS,COLS)

Comments

Popular posts from this blog

card slot machine

Programming

Card Game In Python