Sunday, January 26, 2025

Random Image

/*HTML
*/ function loadRandomPicture() { // Array of 10 possible picture file names const imageFiles = [ "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg", "image10.jpg" ]; // Generate a random index within the range of the array const randomIndex = Math.floor(Math.random() * imageFiles.length); // Get the randomly selected file name const randomImage = imageFiles[randomIndex]; // Create an image element const img = new Image(); // Set the source of the image element img.src = randomImage; // Add an event listener to handle image loading img.onload = () => { // Once the image is loaded, display it (e.g., in an HTML element) document.getElementById("image-container").appendChild(img); }; // Add an event listener to handle image loading errors img.onerror = () => { console.error(`Error loading image: ${randomImage}`); // Handle the error (e.g., display an error message) }; } // Call the function to load a random picture loadRandomPicture();

Thursday, January 9, 2025

Jukebox

Saturday, October 26, 2024

Euchre (Card Game) - Starting the bidding process


The code below starts the bidding process. It's possible now to add graphics, that might be next as well as continuing with picking up. 

Can be tested at https://www.onlinegdb.com/online_python_compiler

#This is to evaluate dealt cards for all four players.
import random

player_num = random.randint(0,3) #Assigns players a number.
suits = ["clubs", "spades", "diamonds", "hearts"]
trump_order = []
cnums_dealt = []
cards = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cards2 = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cnums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
cnumscopy = cnums.copy() #This is for second round bidding.
cnums_value = []
cardsnum_dealt = 23


#Generating cards dealt out
for x in range (21):
    cards_dealt = (random.randint(0,cardsnum_dealt))
    if len (cnums) == 4:
        cnums_number = cnums[cards_dealt]
    trump_order.append(cards[cards_dealt])
    cnums_dealt.append(cnums[cards_dealt])
    cardsnum_dealt = cardsnum_dealt - 1
    cards.pop(cards_dealt)
    cnums.pop(cards_dealt)
#print ("trump order ", trump_order)
#print ("cnums_dealt ", cnums_dealt)
print ("\nThe card the dealer turned over was", trump_order[20])

#Assigning values to each card
if cnums_dealt[20] < 6:  
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be clubs.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 0:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 1:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 3:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 4:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 5:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 12

   suitbid = 5 #filter for clubs in second bid round
   secondsuitbid = 0
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)
 


if cnums_dealt[20] > 5 and cnums_dealt[20] < 12:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be spades.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 6:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 7:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 9:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 10:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 11:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 12

   suitbid = 11 #filter for spades in second bid round
   secondsuitbid = 1

 #print ("New cnums_dealtcopy", cnums_dealtcopy)


 
if cnums_dealt[20] > 11 and cnums_dealt[20] < 18:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be diamonds.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 12

   suitbid = 17 #filter for diamonds in second bid round
   secondsuitbid = 2

 #print ("New cnums_dealtcopy", cnums_dealtcopy)

     
if cnums_dealt[20] > 17 and cnums_dealt[20] < 24:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be hearts.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 12

   suitbid = 23 #filter for hearts in second bid round
   secondsuitbid = 3
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)


player1 = trump_order[0], trump_order[4], trump_order[8], trump_order[12], trump_order[16]
player2 = trump_order[1], trump_order[5], trump_order[9], trump_order[13], trump_order[17]
player3 = trump_order[2], trump_order[6], trump_order[10], trump_order[14], trump_order[18]
player4 = trump_order[3], trump_order[7], trump_order[11], trump_order[15], trump_order[19]

player1_bidding_points = cnums_dealtcopy[0]+cnums_dealtcopy[4]+cnums_dealtcopy[8]+cnums_dealtcopy[12]+cnums_dealtcopy[16]
player2_bidding_points = cnums_dealtcopy[1]+cnums_dealtcopy[5]+cnums_dealtcopy[9]+cnums_dealtcopy[13]+cnums_dealtcopy[17]
player3_bidding_points = cnums_dealtcopy[2]+cnums_dealtcopy[6]+cnums_dealtcopy[10]+cnums_dealtcopy[14]+cnums_dealtcopy[18]
player4_bidding_points = cnums_dealtcopy[3]+cnums_dealtcopy[7]+cnums_dealtcopy[11]+cnums_dealtcopy[15]+cnums_dealtcopy[19]

#print("\nPlayer 1: ",player1, "\nbidding points =", player1_bidding_points)
#print("\nPlayer 2: ",player2, "\nbidding points =", player2_bidding_points)
#print("\nPlayer 3: ",player3, "\nbidding points =", player3_bidding_points)
#print("\nPlayer 4: ",player4, "\nbidding points =", player4_bidding_points)
print("You are player", player_num+1, "\n")

#Is there another way to isolate a player's assignment? This makes them part of a list and can be referenced by position in the list.
playerlist = [player1, player2, player3, player4]
print("Your cards are:", playerlist[player_num])

#Passing or Picking up

for playerbid in range (4):
 #print ("player bid = ", playerbid)
 while playerbid+1 != player_num+1:
  print ("Player ",playerbid+1," will pass.")
  break
 if playerbid+1 == player_num+1 and playerbid+1 !=4:
  bidpickup = input("\nWill you pass or tell the dealer to pick up? Type \'skip' to pass or 'pick up'.\n\n")
  if bidpickup == "pick up":
   print("Will be programmed later, using skip for now.")
if player_num+1 == 4:
 dealerbid = input("\nYou are the dealer. Do you want to pick up \nor pass and go to a second round of bidding?\nType \'skip' to pass or 'pick up'.\n\n")

#print ("suit bid# is ", suitbid)
#print ("cnums is", cnumscopy)
for passbidsuit in range (6):
 cnumscopy.pop(cnumscopy[suitbid-passbidsuit])
#print ("cnums filtered is", cnumscopy)


suits.pop(secondsuitbid)

callsuit = "on"
while callsuit == "on":
 bidpasscall = input("\nWill you pass again or call a suit? Type \'skip' or 'call'.\n")   
 if bidpasscall == ("call"):
  print("\nThree suits left are:",suits)
  callbid = input("Choose one of the suits. \n")
  if callbid == suits[0] or callbid == suits[1] or callbid == suits[2]:
   callsuit = "off"
 elif bidpasscall == ("skip"): #Using else doesn't work here.
  print ("\nMore to be programmed later, call a suit for now.")

print("\nTrump will be", callbid)

Monday, September 30, 2024

Euchre (Card Game) - Placing values based on card turned over

The code below places values based on the card turned over. Next will be to add bidding and including dealer's (player 4) advantage taking the card. Can be tested at https://www.online-python.com/

#This is to evaluate dealt cards for all four players.

import random

trump_order = []
cnums_dealt = []
cards = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cards2 = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cnums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
cnums_value = []
cardsnum_dealt = 23


#Generating cards dealt out
for x in range (21):
    cards_dealt = (random.randint(0,cardsnum_dealt))
    if len (cnums) == 4:
        cnums_number = cnums[cards_dealt]
    trump_order.append(cards[cards_dealt])
    cnums_dealt.append(cnums[cards_dealt])
    cardsnum_dealt = cardsnum_dealt - 1
    cards.pop(cards_dealt)
    cnums.pop(cards_dealt)
#print ("trump order ", trump_order)
#print ("cnums_dealt ", cnums_dealt)
print ("\nThe card the dealer turned over was", trump_order[20])

#Assigning values to each card
if cnums_dealt[20] < 6:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be clubs.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 0:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 1:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 3:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 4:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 5:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 12
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)
 


if cnums_dealt[20] > 5 and cnums_dealt[20] < 12:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be spades.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 6:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 7:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 9:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 10:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 11:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 12

 #print ("New cnums_dealtcopy", cnums_dealtcopy)


 
if cnums_dealt[20] > 11 and cnums_dealt[20] < 18:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be diamonds.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 12

 #print ("New cnums_dealtcopy", cnums_dealtcopy)

     
if cnums_dealt[20] > 17 and cnums_dealt[20] < 24:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be hearts.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 12
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)


player1 = trump_order[0], trump_order[4], trump_order[8], trump_order[12], trump_order[16]
player2 = trump_order[1], trump_order[5], trump_order[9], trump_order[13], trump_order[17]
player3 = trump_order[2], trump_order[6], trump_order[10], trump_order[14], trump_order[18]
player4 = trump_order[3], trump_order[7], trump_order[11], trump_order[15], trump_order[19]

player1_bidding_points = cnums_dealtcopy[0]+cnums_dealtcopy[4]+cnums_dealtcopy[8]+cnums_dealtcopy[12]+cnums_dealtcopy[16]
player2_bidding_points = cnums_dealtcopy[1]+cnums_dealtcopy[5]+cnums_dealtcopy[9]+cnums_dealtcopy[13]+cnums_dealtcopy[17]
player3_bidding_points = cnums_dealtcopy[2]+cnums_dealtcopy[6]+cnums_dealtcopy[10]+cnums_dealtcopy[14]+cnums_dealtcopy[18]
player4_bidding_points = cnums_dealtcopy[3]+cnums_dealtcopy[7]+cnums_dealtcopy[11]+cnums_dealtcopy[15]+cnums_dealtcopy[19]

print("\n\nPlayer 1: ",player1, "\nbidding points =", player1_bidding_points)
print("\nPlayer 2: ",player2, "\nbidding points =", player2_bidding_points)
print("\nPlayer 3: ",player3, "\nbidding points =", player3_bidding_points)
print("\nPlayer 4: ",player4, "\nbidding points =", player4_bidding_points)

Friday, September 13, 2024

Euchre (Card Game) - Placing values based on card turned over

The code below places values based on the card turned over. Next will be to add bidding and including dealer's (player 4) advantage taking the card. Can be tested at https://www.programiz.com/python-programming/online-compiler/ (Remove the 3 lines of "stuff" on the left on their site, or it might not run properly.) 

#This is to evaluate dealt cards for all four players.

import random

trump_order = []
cnums_dealt = []
cards = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cards2 = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cnums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
cnums_value = []
cardsnum_dealt = 23


#Generating cards dealt out
for x in range (21):
    cards_dealt = (random.randint(0,cardsnum_dealt))
    if len (cnums) == 4:
        cnums_number = cnums[cards_dealt]
    trump_order.append(cards[cards_dealt])
    cnums_dealt.append(cnums[cards_dealt])
    cardsnum_dealt = cardsnum_dealt - 1
    cards.pop(cards_dealt)
    cnums.pop(cards_dealt)
#print ("trump order ", trump_order)
#print ("cnums_dealt ", cnums_dealt)
print ("\nThe card the dealer turned over was", trump_order[20])

#Assigning values to each card
if cnums_dealt[20] < 6:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be clubs.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 0:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 1:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 3:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 4:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 5:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 12
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)
 


if cnums_dealt[20] > 5 and cnums_dealt[20] < 12:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be spades.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 12 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 13 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 14 or cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 15 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 16 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 17 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 6:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 7:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 9:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 10:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 11:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 2:
    cnums_dealtcopy[card_num] = 12

 #print ("New cnums_dealtcopy", cnums_dealtcopy)


 
if cnums_dealt[20] > 11 and cnums_dealt[20] < 18:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be diamonds.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 12

 #print ("New cnums_dealtcopy", cnums_dealtcopy)

     
if cnums_dealt[20] > 17 and cnums_dealt[20] < 24:
 cnums_dealtcopy = cnums_dealt.copy()
 #print("cnums_dealtcopy:", cnums_dealtcopy)
 #print("Trump could be hearts.")
 for value in range (13):
  for card_num in range (21):
   if cnums_dealt[card_num] == 0 or cnums_dealt[card_num] == 6 or cnums_dealt[card_num] == 12:
    cnums_dealtcopy[card_num] = 1
   if cnums_dealt[card_num] == 1 or cnums_dealt[card_num] == 7 or cnums_dealt[card_num] == 13:
    cnums_dealtcopy[card_num] = 2
   if cnums_dealt[card_num] == 2 or cnums_dealt[card_num] == 8:
    cnums_dealtcopy[card_num] = 3
   if cnums_dealt[card_num] == 3 or cnums_dealt[card_num] == 9 or cnums_dealt[card_num] == 15:
    cnums_dealtcopy[card_num] = 4
   if cnums_dealt[card_num] ==  4 or cnums_dealt[card_num] == 10 or cnums_dealt[card_num] == 16:
    cnums_dealtcopy[card_num] = 5
   if cnums_dealt[card_num] == 5 or cnums_dealt[card_num] == 11 or cnums_dealt[card_num] == 17:
    cnums_dealtcopy[card_num] = 6
    
   if cnums_dealt[card_num] == 18:
    cnums_dealtcopy[card_num] = 7

   if cnums_dealt[card_num] == 19:
    cnums_dealtcopy[card_num] = 8

   if cnums_dealt[card_num] == 20:
    cnums_dealtcopy[card_num] = 13

   if cnums_dealt[card_num] == 21:
    cnums_dealtcopy[card_num] = 9

   if cnums_dealt[card_num] == 22:
    cnums_dealtcopy[card_num] = 10

   if cnums_dealt[card_num] == 23:
    cnums_dealtcopy[card_num] = 11

   if cnums_dealt[card_num] == 14:
    cnums_dealtcopy[card_num] = 12
    
 #print ("New cnums_dealtcopy", cnums_dealtcopy)


player1 = trump_order[0], trump_order[4], trump_order[8], trump_order[12], trump_order[16]
player2 = trump_order[1], trump_order[5], trump_order[9], trump_order[13], trump_order[17]
player3 = trump_order[2], trump_order[6], trump_order[10], trump_order[14], trump_order[18]
player4 = trump_order[3], trump_order[7], trump_order[11], trump_order[15], trump_order[19]

player1_bidding_points = cnums_dealtcopy[0]+cnums_dealtcopy[4]+cnums_dealtcopy[8]+cnums_dealtcopy[12]+cnums_dealtcopy[16]
player2_bidding_points = cnums_dealtcopy[1]+cnums_dealtcopy[5]+cnums_dealtcopy[9]+cnums_dealtcopy[13]+cnums_dealtcopy[17]
player3_bidding_points = cnums_dealtcopy[2]+cnums_dealtcopy[6]+cnums_dealtcopy[10]+cnums_dealtcopy[14]+cnums_dealtcopy[18]
player4_bidding_points = cnums_dealtcopy[3]+cnums_dealtcopy[7]+cnums_dealtcopy[11]+cnums_dealtcopy[15]+cnums_dealtcopy[19]

print("\n\nPlayer 1: ",player1, "\nbidding points =", player1_bidding_points)
print("\nPlayer 2: ",player2, "\nbidding points =", player2_bidding_points)
print("\nPlayer 3: ",player3, "\nbidding points =", player3_bidding_points)
print("\nPlayer 4: ",player4, "\nbidding points =", player4_bidding_points)

Thursday, September 12, 2024

Euchre (Card Game) Placing values (using dictionary command)

Below is code to show possible trump with values. The dictionary {} was used, and it nicely lists things without [] brackets. Next will be to actually compare the cards dealt. Either that code will be put back in or something new will replace. Can be tested at https://www.programiz.com/python-programming/online-compiler/ (Remove the 3 lines of "stuff" on the left on their site, or it might not run properly.)

import random

trump_order = []
cnums_dealt = []
cards = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cnums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
cardsnum_dealt = 23

#Generating cards dealt out
for x in range (21):
    cards_dealt = (random.randint(0,cardsnum_dealt))
    if len (cnums) == 4:
        cnums_number = cnums[cards_dealt]
    trump_order.append(cards[cards_dealt])
    cnums_dealt.append(cnums[cards_dealt])
    cardsnum_dealt = cardsnum_dealt - 1
    cards.pop(cards_dealt)
    cnums.pop(cards_dealt)
print ("trump order ", trump_order)
print ("cnums_dealt ", cnums_dealt)
print ("\nThe card the dealer turned over was", trump_order[20])

#Assigning values to each card
if cnums_dealt[20] < 6:
 print("Trump could be clubs.")
 clubstrump =    {
  "High Trump": "\nTop 3: A♣ J♠ J♣", "High Trump2": "Other trump: 9♣ 10♣ Q♣ K♣",
  "One Point": "\n1 point cards: 9♠ 9♦ 9♥",
  "Two Points": "\n2 point cards: 10♠ 10♦ 10♥",
  "Three Points": "\n3 point cards: J♦ J♥",
  "Four Points": "\n4 point cards: Q♠ Q♦ Q♥",
  "Five Points": "\n5 point cards: K♠ K♦ K♥",
  "Six Points": "\n6 point cards: A♠ A♦ A♥",
}
 print(clubstrump["High Trump"],clubstrump["High Trump2"], clubstrump["One Point"], clubstrump["Two Points"], clubstrump["Three Points"], clubstrump["Four Points"], clubstrump["Five Points"], clubstrump["Six Points"])

if cnums_dealt[20] > 5 and cnums_dealt[20] < 12:
 print("Trump could be spades.")
 spadestrump =    {
  "High Trump": "\nTop 3: A♠ J♣ J♠", "High Trump2": "Other trump: 9♠ 10♠ Q♠ K♠",
  "One Point": "\n1 point cards: 9♣ 9♦ 9♥",
  "Two Points": "\n2 point cards: 10♣ 10♦ 10♥",
  "Three Points": "\n3 point cards: J♦ J♥",
  "Four Points": "\n4 point cards: Q♣ Q♦ Q♥",
  "Five Points": "\n5 point cards: K♣ K♦ K♥",
  "Six Points": "\n6 point cards: A♣ A♦ A♥",
}
 print(spadestrump["High Trump"],spadestrump["High Trump2"], spadestrump["One Point"], spadestrump["Two Points"], spadestrump["Three Points"], spadestrump["Four Points"], spadestrump["Five Points"], spadestrump["Six Points"])
 
if cnums_dealt[20] > 11 and cnums_dealt[20] < 18:
 print("Trump could be diamonds.")
 diamondtrump = {
  "High Trump": "\nTop 3: A♦ J♥ J♦", "High Trump2": "Other trump: 9♦, 10♦, Q♦, K♦",
  "One Point": "\n1 point cards: 9♣ 9♠ 9♥",
  "Two Points": "\n2 point cards: 10♣ 10♠ 10♥",
  "Three Points": "\n3 point cards: J♣ J♠",
  "Four Points": "\n4 point cards: Q♣ Q♠ Q♥",
  "Five Points": "\n5 point cards: K♣ K♠ K♥",
  "Six Points": "\n6 point cards: A♣ A♠ A♥",
}

 print(diamondtrump["High Trump"],diamondtrump["High Trump2"], diamondtrump["One Point"], diamondtrump["Two Points"], diamondtrump["Three Points"], diamondtrump["Four Points"], diamondtrump["Five Points"], diamondtrump["Six Points"])
     
if cnums_dealt[20] > 17 and cnums_dealt[20] < 24:
 print("Trump could be hearts.")
 heartstrump = {
  "High Trump": "\nTop 3: A♥ J♦ J♥", "High Trump2": "Other trump: 9♥, 10♥, Q♥, K♥",
  "One Point": "\n1 point cards: 9♣ 9♠ 9♦",
  "Two Points": "\n2 point cards: 10♣ 10♠ 10♦",
  "Three Points": "\n3 point cards: J♣ J♠",
  "Four Points": "\n4 point cards: Q♣ Q♠ Q♦",
  "Five Points": "\n5 point cards: K♣ K♠ K♦",
  "Six Points": "\n6 point cards: A♣ A♠ A♦",

}
 print(heartstrump["High Trump"], heartstrump["High Trump2"], heartstrump["One Point"], heartstrump["Two Points"], heartstrump["Three Points"], heartstrump["Four Points"], heartstrump["Five Points"], heartstrump["Six Points"])

Sunday, September 1, 2024

Euchre (Card Game) Evaluating Possible Trump

First Euchre page can be read at:

https://1a2b3c4d5e6f7g8h9i10j11k12l13m14n.blogspot.com/2024/07/

 

Below is code to check if jacks and aces were dealt to all four players. Next, will be to compare each hand to the card turned over. Can be tested at https://www.programiz.com/python-programming/online-compiler/ (Remove the 3 lines of "stuff" on the left on their site, or it might not run properly.)

 

#This is to evaluate dealt cards for all four players.

import random

trump_order = []
cnums_dealt = []
#trump_firstplayer = random.randint(0,3) / to determine who is the dealer and order of bidding
trump_firstplayer = 0
cards = ["9♣", "10♣", "J♣", "Q♣", "K♣", "A♣", "9♠", "10♠", "J♠", "Q♠", "K♠", "A♠", "9♦", "10♦", "J♦", "Q♦", "K♦", "A♦", "9♥", "10♥", "J♥", "Q♥", "K♥", "A♥"]
cnums = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"]
player1 = []
player2 = []
player3 = []
player4 = []
player1_potential = []
player2_potential = []
player3_potential = []
player4_potential = []
cnums_number = 0
cardsnum_dealt = 23
trump_suit = 0
round1 = ["bid"]
round2 = []
round3 = []
round4 = []
round5 = [] #NEED TO ADD 4 OR 5 AND LOOP FOR ROUNDS

#Generating cards dealt out
for x in range (21):
    cards_dealt = (random.randint(0,cardsnum_dealt))
    if len (cnums) == 4:
        cnums_number = cnums[cards_dealt]
    trump_order.append(cards[cards_dealt])
    cnums_dealt.append(cnums[cards_dealt])
    cardsnum_dealt = cardsnum_dealt - 1
    cards.pop(cards_dealt)
    cnums.pop(cards_dealt)
print ("trump order ", trump_order)
print ("cnums_dealt ", cnums_dealt)
print ("\nThe card the dealer turned over was", trump_order[20])

#Assgning cards to each hand
player1 = trump_order[0], trump_order[4], trump_order[8], trump_order[12], trump_order[16]
player2 = trump_order[1], trump_order[5], trump_order[9], trump_order[13], trump_order[17]
player3 = trump_order[2], trump_order[6], trump_order[10], trump_order[14], trump_order[18]
player4 = trump_order[3], trump_order[7], trump_order[11], trump_order[15], trump_order[19]


#Corresponding card assignment to numbers
player1_potential = int(cnums_dealt[0]), int(cnums_dealt[4]), int(cnums_dealt[8]), int(cnums_dealt[12]), int(cnums_dealt[16])
player2_potential = int(cnums_dealt[1]), int(cnums_dealt[5]), int(cnums_dealt[9]), int(cnums_dealt[13]), int(cnums_dealt[17])
player3_potential = int(cnums_dealt[2]), int(cnums_dealt[6]), int(cnums_dealt[10]), int(cnums_dealt[14]), int(cnums_dealt[18])
player4_potential = int(cnums_dealt[3]), int(cnums_dealt[7]), int(cnums_dealt[11]), int(cnums_dealt[15]), int(cnums_dealt[19])


#cjackace = ["2", "5", "8", "11", "14", "17", "20", "23"]
cjackace = [2, 5, 8, 11, 14, 17, 20, 23]
cjackace_pop1 = [2, 5, 8, 11, 14, 17, 20, 23]
player1card = [cnums_dealt[0], cnums_dealt[4], cnums_dealt[8], cnums_dealt[12], cnums_dealt[16]]
player2card = [cnums_dealt[1], cnums_dealt[5], cnums_dealt[9], cnums_dealt[13], cnums_dealt[17]]
player3card = [cnums_dealt[2], cnums_dealt[6], cnums_dealt[10], cnums_dealt[14], cnums_dealt[18]]
player4card = [cnums_dealt[3], cnums_dealt[7], cnums_dealt[11], cnums_dealt[15], cnums_dealt[19]]

print ("player 1: ", player1, " - player 1 potential: ", player1_potential)
print ("player 2: ", player2, " - player 2 potential: ", player2_potential)
print ("player 3: ", player3, " - player 3 potential: ", player3_potential)
print ("player 4: ", player4, " - player 4 potential: ", player4_potential)

#Evaluating each hand

print ("\n\n")

player1_potential_results = [] ##If in loops, it will reset each time##
player2_potential_results = []
player3_potential_results = []
player4_potential_results = []

for count_topcards in range (4):
    for all_cards in range (20):##If 1t is 19, it won't indicate if the fifth card in player 4's hand is trump##
        player1_check = player1card[count_topcards]
        player2_check = player2card[count_topcards]
        player3_check = player3card[count_topcards]
        player4_check = player4card[count_topcards]
        cnums_get = cnums_dealt[all_cards]
        cnums_get = int(cnums_get)
        if cnums_get == cjackace [0] or cnums_get == cjackace [1] or cnums_get == cjackace [2] or cnums_get == cjackace [3] or cnums_get == cjackace [4] or cnums_get == cjackace [5] or cnums_get == cjackace [6] or cnums_get == cjackace [7]:            
           if cnums_get == player1_potential [0] or cnums_get == player1_potential [1] or cnums_get == player1_potential [2] or cnums_get == player1_potential [3] or cnums_get == player1_potential [4]:                   
             if trump_order[all_cards] not in player1_potential_results:
              player1_potential_results.append(trump_order[all_cards])
              
           if cnums_get == cjackace [0] or cnums_get == cjackace [1] or cnums_get == cjackace [2] or cnums_get == cjackace [3] or cnums_get == cjackace [4] or cnums_get == cjackace [5] or cnums_get == cjackace [6] or cnums_get == cjackace [7]:            
            if cnums_get == player2_potential [0] or cnums_get == player2_potential [1] or cnums_get == player2_potential [2] or cnums_get == player2_potential [3] or cnums_get == player2_potential [4]:                   
              if trump_order[all_cards] not in player2_potential_results:
               player2_potential_results.append(trump_order[all_cards])
                    
            if cnums_get == cjackace [0] or cnums_get == cjackace [1] or cnums_get == cjackace [2] or cnums_get == cjackace [3] or cnums_get == cjackace [4] or cnums_get == cjackace [5] or cnums_get == cjackace [6] or cnums_get == cjackace [7]:            
             if cnums_get == player3_potential [0] or cnums_get == player3_potential [1] or cnums_get == player3_potential [2] or cnums_get == player3_potential [3] or cnums_get == player3_potential [4]:                   
              if trump_order[all_cards] not in player3_potential_results:
               player3_potential_results.append(trump_order[all_cards])
                    
            if cnums_get == cjackace [0] or cnums_get == cjackace [1] or cnums_get == cjackace [2] or cnums_get == cjackace [3] or cnums_get == cjackace [4] or cnums_get == cjackace [5] or cnums_get == cjackace [6] or cnums_get == cjackace [7]:            
             if cnums_get == player4_potential [0] or cnums_get == player4_potential [1] or cnums_get == player4_potential [2] or cnums_get == player4_potential [3] or cnums_get == player4_potential [4]:                   
              if trump_order[all_cards] not in player4_potential_results:
               player4_potential_results.append(trump_order[all_cards])
 

if len(player1_potential_results) == 0:
 print("Player 1 has no possible top trump cards.")
else:
 print ("Player 1 has possible trump!! The cards are:", player1_potential_results)
if len(player2_potential_results) == 0:
 print("Player 2 has no possible top trump cards.")
else:
 print ("Player 2 has possible trump!! The cards are:", player2_potential_results)
if len(player3_potential_results) == 0:
 print("Player 3 has no possible top trump cards.")
else:
 print ("Player 3 has possible trump!! The cards are:", player3_potential_results)
if len(player4_potential_results) == 0:
 print("Player 4 has no possible top trump cards.")
else:
 print ("Player 4 has possible trump!! The cards are:", player4_potential_results)

Random Image