Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- ####################################################
- def deck_creation():
- colours = ["red","black","yellow"]
- deck = []
- b=-10
- for i in range(3):
- b+=10
- for a in range(10):
- deck.append([])
- deck[(a+b)].append(a+1)
- deck[(a+b)].append(colours[i])
- random.shuffle(deck)
- return (deck)
- ####################################################
- creds = [["a","a"], ["james", "the"], ["mat", "dog"]]
- a=0
- while a < 1:
- print("")
- user=input("Enter Your Username:")
- pas=input("Enter Your Password:")
- for item in creds:
- if item[0] == user and item[1]==pas:
- print ("__________________________login successfull!__________________________")
- deck = deck_creation()
- a=+1
- else: print ("------", end="")
- ####################################################
- player1 =[]
- player2 =[]
- for i in range(15):
- player1.append(deck[0])
- player2.append(deck[1])
- deck.remove(deck[0])
- deck.remove(deck[0])
- ####################################################
- def p1w():
- print ("Player1 Won!")
- print ("player1 cards=", player1[0], "player2 cards=", player2[0])
- player1_wins.append(player1[0])
- player1_wins.append(player2[0])
- player1.remove(player1[0])
- player2.remove(player2[0])
- def p2w():
- print ("Player2 Won!")
- print ("player1 cards=", player1[0], "player2 cards=", player2[0])
- player2_wins.append(player1[0])
- player1_wins.append(player2[0])
- player2.remove(player2[0])
- player1.remove(player1[0])
- ####################################################
- player1_wins=[]
- player2_wins=[]
- for i in range(15):
- if player1[0][1] == player2[0][1]:
- if player1[0][0] > player2[0][0]:p1w()
- else:p2w()
- elif player1[0][1] == "red" and player2[0][1]== "black": p1w()
- elif player2[0][1] == "red" and player1[0][1]== "black": p2w()
- elif player1[0][1] == "yellow" and player2[0][1]== "red": p1w()
- elif player2[0][1] == "yellow" and player1[0][1]== "red": p2w()
- elif player1[0][1] == "black" and player2[0][1]== "yellow": p1w()
- elif player2[0][1] == "black" and player1[0][1]== "yellow": p2w()
- print ("-------------------------------------------------------------------------")
- print ("player1 wins = ", player1_wins, " TOTAL =", len(player1_wins))
- print ("")
- print ("player2 wins = ", player2_wins, " TOTAL =", len(player2_wins))
- print ("")
- if (len(player1_wins))>(len(player2_wins)): print ("OVERALL Player1 WINS")
- else: print ("OVERALL Player2 WINS")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement