Sorry about that, I thought it was clear that n = number randomly chosen. I was thinking of if the number was a five, it would choose a card with a five on it. I don't want to have to code stuff that I have to repeat again and again. I'm not worrying about card types, I have that figured out separately. The two games are indeed separate, too much trouble to do them a 1 program that can play both games. Maybe I should have shown my code and asked using the code as a visual reference. ----- Original Message ----- From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Tutor mailing list" <tutor@python.org> Sent: Wednesday, August 03, 2005 1:14 AM Subject: Re: [Tutor] I need advice about which way to go.
> Hi Nathan, > > The problem with this problem descripton is that you have an idea > clear in your own head but the rest oif us only have the words. > So... > >> I am writing a poker game and a blackjack game. > > Two separate games or one game that can play both? > >> I was wondering which way would be Python smart and work properly. > > That depends on you really, there is no Python way to write card games > (unless you count using PyGame but even thats not mandatory). This is > really a matter of design and Python doesn't impose many limits on that, > there are lots of valid approaches you could take. > >> I am trying to figure out whether or not to use t(n) as a card indicator, >> when n = randomly drawn number. > > t(n) means a function called t that takes a parameter called n. I'm > not sure how you would use that as a card indicator. Are you confusing > functions and lists? Do you mean t[n] where n is an index into a list > called t? Then if t held all the card values (or names) n could indicate > one particular card. That might work. > > Another way could be a dictionary with a coded name per card as the key > along with the value. (Aces pose a problem regardless of solution because > they have two values) > >> I could go that way, or code it as t1, t2, t3, etc. > > Having 52 variables, one per card could work but seems clumsy. > Also figuring out how to deal a hand would be tricky with discreet > variables. > >> Which way is the right and correct way to go? > > There is no single right way, but a collection of some sort sounds > better than a set of independant variables. > >> Also for blackjack, I want to use it as playertotal = playertotal + n, >> and computertotal = computertotal + n. or 1,2,3, etc. Which is better? > > I don't understand that bit at all?! What does 'n'represent? > What are the 1,2,3 for? > > Alan G. > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor