<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>
&nbsp;<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>
&nbsp;<BR>
Here is my Program so far<BR>
I will also include a .py file of it incase this doesnt look legible<BR>
&nbsp;<BR>
from random import*<BR>
&nbsp;<BR>
<BR>def DisplayTitle():<BR>&nbsp;&nbsp;&nbsp; print<BR>&nbsp;&nbsp;&nbsp; print "Welcome to Tech-Sauve Cribbage"<BR>&nbsp;&nbsp;&nbsp; print "--------------------------------------------"<BR>&nbsp;&nbsp;&nbsp; print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Insctructions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "<BR>&nbsp;&nbsp;&nbsp; print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<BR>&nbsp;&nbsp;&nbsp; print "1) Only played with two players (for now)&nbsp;&nbsp; "<BR>&nbsp;&nbsp;&nbsp; print "2) The program starts with a full deck of 52 cards"<BR>&nbsp;&nbsp;&nbsp; print "3) Deals out 6 cards to each player with a Suit letter"<BR>&nbsp;&nbsp;&nbsp; print "4) Then asks each player what 2 cards they want to discard to the crib"<BR>&nbsp;&nbsp;&nbsp; print "5) Then the program saves the crib in a temporary deck"<BR>&nbsp;&nbsp;&nbsp; print "6) Players start showing cards to get an ammount equal to 31"<BR>&nbsp;&nbsp;&nbsp; print "7) Once all the cards have been played, program counts the score"<BR>&nbsp;&nbsp;&nbsp; print "8) Then the program will count all possible scores in each hand"<BR>&nbsp;&nbsp;&nbsp; print "&nbsp;&nbsp; And it will add the players points to their total score"<BR>&nbsp;&nbsp;&nbsp; print "9) First player to reach a score of 121 wins the game"<BR>#Gets players names<BR>def GetPlayer1():<BR>&nbsp;&nbsp;&nbsp; print<BR>&nbsp;&nbsp;&nbsp; Player1 = str(raw_input("Player 1's name "))<BR>&nbsp;&nbsp;&nbsp; return Player1<BR>def GetPlayer2():<BR>&nbsp;&nbsp;&nbsp; print<BR>&nbsp;&nbsp;&nbsp; Player2 = str(raw_input("Player 2's name "))<BR>&nbsp;&nbsp;&nbsp; return Player2<BR>#Building the deck<BR>def Build_Deck():<BR>&nbsp;&nbsp;&nbsp; for R in range (0,52):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cardnumb = numbers[R]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cardsuit = suits[R]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; card = str(numbers[R])+str(suits[R])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deck.append(card)<BR>&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; Y = randint(0,ele)<BR>&nbsp;&nbsp;&nbsp; draw = Deck[Y]<BR>&nbsp;&nbsp;&nbsp; P1hand.append(draw)<BR>&nbsp;&nbsp;&nbsp; Deck.pop(Y)<BR>&nbsp;&nbsp;&nbsp; ele -= 1<BR>for X2 in range (0,6):<BR>&nbsp;&nbsp;&nbsp; Y1 = randint(0,ele)<BR>&nbsp;&nbsp;&nbsp; draw2 = Deck[Y1]<BR>&nbsp;&nbsp;&nbsp; P2hand.append(draw2)<BR>&nbsp;&nbsp;&nbsp; Deck.pop(Y1)<BR>&nbsp;&nbsp;&nbsp; ele -= 1<BR>print<BR>Top = randint(0,47)<BR>Topcard = Deck[Top]<BR>print<BR>for count in range(0,2):<BR>&nbsp;&nbsp;&nbsp; print P1hand<BR>&nbsp;&nbsp;&nbsp; print<BR>&nbsp;&nbsp;&nbsp; option = str(raw_input("Player 1,what CARD would you like to add to the crib?&nbsp; CARDS 1 thru 6 "))<BR>&nbsp;&nbsp;&nbsp; if option == "1":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[0])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(0)<BR>&nbsp;&nbsp;&nbsp; elif option == "2":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[1])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(1)<BR>&nbsp;&nbsp;&nbsp; elif option == "3":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[2])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(2)<BR>&nbsp;&nbsp;&nbsp; elif option == "4":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[3])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(3)<BR>&nbsp;&nbsp;&nbsp; elif option == "5":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[4])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(4)<BR>&nbsp;&nbsp;&nbsp; elif option == "6":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P1hand[5])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P1hand.pop(5)<BR>print<BR>for c2 in range(0,2):<BR>&nbsp;&nbsp;&nbsp; print P2hand<BR>&nbsp;&nbsp;&nbsp; print<BR>&nbsp;&nbsp;&nbsp; option1 = str(raw_input("Player 2, what CARD would you like to add to the crib?&nbsp; CARDS 1 thru 6 "))<BR>&nbsp;&nbsp;&nbsp; if option1 == "1":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[0])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P2hand.pop(0)<BR>&nbsp;&nbsp;&nbsp; elif option1 == "2":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[1])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P2hand.pop(1)<BR>&nbsp;&nbsp;&nbsp; elif option1 == "3":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[2])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P2hand.pop(2)<BR>&nbsp;&nbsp;&nbsp; elif option1 == "4":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[3])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P2hand.pop(3)<BR>&nbsp;&nbsp;&nbsp; elif option1 == "5":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[4])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P2hand.pop(4)<BR>&nbsp;&nbsp;&nbsp; elif option1 == "6":<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Crib.append(P2hand[5])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>