| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Comments:
<0> pianoboy3333: are you using wxPython by any chance? <1> I saved it as something else earlier...okay, it's reopened. <2> ahmeni: no, why? <3> will you be using multiple decks? <1> For the game I'm going for, no. <0> pianoboy3333: it's got it's own system tray thing, but it doesn't matter as you're not using it :) <1> However, that might be a good thing for future use. <4> but you might later, like if you make this into a server that hosts multiple games. <1> ironfroggy: I'm out counting on that so fast. <2> ahmeni: no, I'm planning on learning pygtk <1> There aren't many Three Card Poker games as is on the web...so I might as well try to get something added, even if it's just text-based. <1> Someone else can add the graphics. <4> another reason i advocated not dealing with presentation at this level. <1> Well, we have to make a Deck first. <3> do we? <4> deltab: i think so.
<0> graphics and networking aren't too hard, once you've got the basics down, pygame and Twisted aren't too hard (if and when you feel like it) <3> the cards can be stored in a list <3> and generated by a function <4> deltab: the deck cl*** can also represent the concept of a Standard Playing Deck <3> how would that concept be used? <4> in which case it would be the logical place to create the necessary ranks and suits <1> We haven't quite decided how to represent suits and ranks fully <4> Wolfman2000: im suggesting you use the Deck cl*** for that <3> Wolfman2000: an instance of Suit for each suit <1> Let me rephrase. <3> Wolfman2000: and an instance of Rank for each rank <1> Do we use numbers for the suits and ranks, words, or something else? <1> There are many choices available. <4> Wolfman2000: sketch the Deck cl*** as you see it currently, and we'll work from there. <4> Wolfman2000: none. <3> Wolfman2000: no, instance of Suit and Rank <4> Wolfman2000: they dont need any value. they can be distinguished by the identity of the Rank and Suit instances you will create. <1> Let's see if I can get that step done. <4> ok <4> deltab: ive been wanting to write a tutorial. do you think this is a good source for it? <3> the idea of representing cards is a popular one for tutorials <1> Are double lists possible in Python, or must I go with Tuples here? <3> they're complex enough to be interesting, but simple enough to be understood <3> Wolfman2000: what do you mean by double lists? <4> im going to include in it both the good ways to do things, and the wrong ways. to show "this is what you might think, but here is a more elegant solution". does that seem like a good thing, or pompous? <1> in Java, an array is []. A 2-D array is [][]. I wonder if [][] works in Python...but I'm thinking [(x,y)] works better. <5> does a function exist to get an int as a binary string? <6> Wolfman2000, lists in lists <4> that would work, but it worries me because i dont think you need that at all for a Deck cl***. proceed anyway. we'll see what you've got :-) <3> Wolfman2000: python doesn't have any 2d structures built in <1> Yep: Tuple it. <3> Wolfman2000: what for? <4> Stinger_: you can try struct <4> deltab: lets let him write the Deck cl*** and see what he has. <3> Stinger_: define what you mean by 'binary' <1> Each card in the deckOfCards will be a tuple of suit and rank. <4> besides, i want those rough versions for use in the tutorial. <5> 9 -> '1001' <4> Wolfman2000: thats what you have the Card cl*** for! <3> Stinger_: no such function built-in, depsite the reverse being easily available <5> hmm odd <1> Update coming. <1> It's up. <3> ironfroggy: personally I'd start with strings and tuples until methods become useful <1> Well, we'll figure this out one way or another. <4> deltab: im advocating slight overengineer for the purposes of example. <3> yeah, but Wolfman2000 is ignoring it <1> ...whoops: forgot Object <1> wait a second...drat: didn't save <4> Wolfman2000: why arent you using the Card cl***? or the Rank cl***? or the Suit cl***? <4> deltab: good. better the tutorial to be! <1> ...wasn't quite sure how to get those in yet, stupidly enough. <1> Card, I guess I should have figured out. <7> Stinger_, looks like there is a recipe on Activestate <4> let me make some changes.. <1> I just re-added (object) in there <3> I suspect it is because they aren't useful concepts yet, being too abstracted from a concrete representation <1> Perhaps comments should be added more liberally? <1> I've heard different things on comments as well. Some say over comment, some say bad comments are worse than none, and I'm sure others say plenty more. <3> Wolfman2000: do you know about for loops? <1> I forgot how Python handled them.
<1> It was easier for me to use while's <3> for x in ['A', 'B', 'C']: <1> ...I don't exactly have an array setup here. <1> I kind of start with an empty list. <3> huh? <3> for x in ['A', 'B', 'C']: print x <1> ...let me try this again. <1> I don't have a list to iterate over. <3> x takes each of the values in the list in turn <1> How can you do a for loop without such list to iterate over? <3> ['A', 'B', 'C'] is a list <1> ...okay, new example. <3> so is ['C', 'H', 'S', 'D'] <4> see my update <4> I showed how the Suits would work, but i left the Ranks (hey, more of those) for you to add in <4> do you understand the techniques involved now and see how to apply it to the Ranks? <1> I think so. <4> ok add the ranks to that and we'll continue. <3> I'd make named lists for the suits and ranks <1> ...think I'd need names for 3 to 10? Ace is Ace, Two is Duece, but...shouldn't there be more unique names for the other cards besides their digit? <3> suits = [spades, cluibs, hearts, diamonds] <4> deltab: in which case you'd just wrongly rely on their order at some point. <3> for suit in suits <3> ironfroggy: okay, sets than <4> deltab: ok <4> Wolfman2000: rank2...rank10 <3> or two, three, four <4> yes or that <1> It's up: brb while I take some claritin <4> druggy <0> python is the best programming language for druggies <1> back: the stupid pill had trouble getting out of its container. <1> Now...I see where deltab's idea of a list would have helped: using three \s to break up the for loop is...messy, isn't it? <4> look again <4> I specifically made it a set, rather than a list, to emphasize that this level shouldnt care about any order to ranks or suits <4> brb <1> I'm not familiar with the set command. <4> its a type not a command <8> set is a new (2.3) datatype <8> I just used them for the first time tongiht, actually <4> its a container that collects unique, unordered objects <1> I've updated my code base...I'd prefer staying in 80 lines. <1> 80 characters* <1> drat: missed a slash <4> its hard to keep nice like that working in pastebin <1> wait...the slash disappeared! <1> ...alright, I'll break that suggestion for the purposes of this tutorial. <4> so anyway. you can create a deck. now, what do you want to do with it next? <3> the first comment is wrong, since the code there doesn't actually create a deck, just defines how to do it <1> The original purpose was to make the deck. <1> In any case...if this file is left alone, we've got ourselves a perfectly usable deck, am I right? <3> only a defintion of how to make one <4> more or less, but actually doing anything with the cards isnt fun yet. <3> you have to call Deck() to get a deck <1> So the first comment should be... <4> deltab: makes a good point for clarity. <1> #This file sets up how a 52 card deck will eventually be made. <3> # A 52 card deck with no jokers <3> hrm <3> I don't know <1> In any case...what to do with the deck... <4> the module comment aside, what is the first thing you'll do with a deck? <1> The first thing, besides making cards...drawing one. <4> so you open a freshly bought deck of cards, draw the first one on the top of the brand new deck and start playing? <1> ...freshly...well, if you wanted to play some freaky game, perhaps. <1> Okay, you should shuffle first. <4> so what will you write next to accomodate that? <1> I'd think a def in the Deck method would be a good thing. <4> i agree. <1> Now, I'm sure there are many ways to actually shuffle here...but no matter what, will import random be required? <4> yes. you'll use that random.shuffle mentioned earlier. <1> Then...should self.cards be moved to the top of the cl***? <1> I don't know if I can call self.cards if it was just in __init__. <4> yes, you can.
Return to
#python or Go to some related
logs:
#ldap #web ubuntu64bit intel 845gm express linux SMBus: Intel Corp.: Unknown device 27da (rev 01) #linux #web #math update-initramfs ubuntu Mandriva bad superblock
|
|