<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
My name is Chris Schueler and i am having some troubles with my Python programming<BR>
<BR>
Our current project is to create the game of cribbage from scratch.<BR>
The only problem is we are not allowed to use classes, only user-defind functions and arrays. I was wondering if anybody could give me tips or pointers on adding codes or modifying some of my program<BR>
<BR>
Here is my Program so far<BR>
I will also include a .py file of it incase this doesnt look legible<BR>
<BR>
from random import*<BR>
<BR>
<BR>def DisplayTitle():<BR> print<BR> print "Welcome to Tech-Sauve Cribbage"<BR> print "--------------------------------------------"<BR> print " Insctructions "<BR> print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<BR> print "1) Only played with two players (for now) "<BR> print "2) The program starts with a full deck of 52 cards"<BR> print "3) Deals out 6 cards to each player with a Suit letter"<BR> print "4) Then asks each player what 2 cards they want to discard to the crib"<BR> print "5) Then the program saves the crib in a temporary deck"<BR> print "6) Players start showing cards to get an ammount equal to 31"<BR> print "7) Once all the cards have been played, program counts the score"<BR> print "8) Then the program will count all possible scores in each hand"<BR> print " And it will add the players points to their total score"<BR> print "9) First player to reach a score of 121 wins the game"<BR>#Gets players names<BR>def GetPlayer1():<BR> print<BR> Player1 = str(raw_input("Player 1's name "))<BR> return Player1<BR>def GetPlayer2():<BR> print<BR> Player2 = str(raw_input("Player 2's name "))<BR> return Player2<BR>#Building the deck<BR>def Build_Deck():<BR> for R in range (0,52):<BR> cardnumb = numbers[R]<BR> cardsuit = suits[R]<BR> card = str(numbers[R])+str(suits[R])<BR> Deck.append(card)<BR> return Deck,numbers,suits,card,cardnumb,cardsuit<BR>
<BR>#Variables Needed<BR>numbers = ["A","2","3","4","5","6","7","8","9","10","J","Q","K"]*4<BR>suits = ["H","C","S","D"]*13<BR>suits.sort()<BR>Deck = []<BR>P1hand = []<BR>P2hand = []<BR>Crib = []<BR>Cribcard = []<BR>Cribsuit = []<BR>P1_score = 0<BR>P2_score = 0<BR>Winner = 121<BR>ele = 52<BR>Deck,numbers,suits,card,cardnumb,cardsuit = Build_Deck()<BR>for X in range(0,6):<BR> Y = randint(0,ele)<BR> draw = Deck[Y]<BR> P1hand.append(draw)<BR> Deck.pop(Y)<BR> ele -= 1<BR>for X2 in range (0,6):<BR> Y1 = randint(0,ele)<BR> draw2 = Deck[Y1]<BR> P2hand.append(draw2)<BR> Deck.pop(Y1)<BR> ele -= 1<BR>print<BR>Top = randint(0,47)<BR>Topcard = Deck[Top]<BR>print<BR>for count in range(0,2):<BR> print P1hand<BR> print<BR> option = str(raw_input("Player 1,what CARD would you like to add to the crib? CARDS 1 thru 6 "))<BR> if option == "1":<BR> Crib.append(P1hand[0])<BR> P1hand.pop(0)<BR> elif option == "2":<BR> Crib.append(P1hand[1])<BR> P1hand.pop(1)<BR> elif option == "3":<BR> Crib.append(P1hand[2])<BR> P1hand.pop(2)<BR> elif option == "4":<BR> Crib.append(P1hand[3])<BR> P1hand.pop(3)<BR> elif option == "5":<BR> Crib.append(P1hand[4])<BR> P1hand.pop(4)<BR> elif option == "6":<BR> Crib.append(P1hand[5])<BR> P1hand.pop(5)<BR>print<BR>for c2 in range(0,2):<BR> print P2hand<BR> print<BR> option1 = str(raw_input("Player 2, what CARD would you like to add to the crib? CARDS 1 thru 6 "))<BR> if option1 == "1":<BR> Crib.append(P2hand[0])<BR> P2hand.pop(0)<BR> elif option1 == "2":<BR> Crib.append(P2hand[1])<BR> P2hand.pop(1)<BR> elif option1 == "3":<BR> Crib.append(P2hand[2])<BR> P2hand.pop(2)<BR> elif option1 == "4":<BR> Crib.append(P2hand[3])<BR> P2hand.pop(3)<BR> elif option1 == "5":<BR> Crib.append(P2hand[4])<BR> P2hand.pop(4)<BR> elif option1 == "6":<BR> Crib.append(P2hand[5])<BR> P2hand.pop(5)<BR><BR>print Deck<BR>print "The TOP CARD is ",Topcard<BR>print "Player 1's Hand is ",P1hand<BR>print "Player 2's Hand is ",P2hand<BR>print "The 4 cards in the Crib are ",Crib<BR>                                            <br /><hr />Get a great deal on Windows 7 and see how it works the way you want. <a href='http://go.microsoft.com/?linkid=9691813' target='_new'>See the Windows 7 offers now.</a></body>
</html>