[Tutor] Baccarat code check.

col speed ajarncolin at gmail.com
Sat Dec 17 10:56:45 CET 2011


On 17 December 2011 16:40, Dave Angel <d at davea.name> wrote:
> On 12/16/2011 03:29 AM, col speed wrote:
>>
>> If anyone has the time, please have a look at the attached text file
>> and let me know any comments on how to improve it.
>> Thanks a lot
>> Col
>>
> I don't see any response for 24 hours, so I'd say that nobody has the time.
>  However, you could have improved the odds substantially by giving us a clue
> what you were looking for.
>
> Is this a program that runs properly, correctly and quickly enough, and you
> just want advice on making the code cleaner and clearer?
>
> Or does the program run apparently normally, but gets the wrong results, and
> you need help fixing that?  If so, tell us specifically what seems to be
> wrong:   what happens when you run it, and what did you expect different?
>
> Or does the program die with some exception?  in that case, tell us how to
> reproduce the symptom, and show us the full traceback when it dies.
>
> Or something else?
>
> ....
> I can only guess the first case is your supposed situation.  So I'll look it
> over.  I'm not running it, so all i can comment on is obvious bugs and
> stylistic errors.  I also have to assume you're running it on a Linux type
> machine, with Python 2.7.
>
> I don't know baccarat, so I make mistakes on that account.
>
> First obvious problem is that each player has its own kitty.  I don't know
> of any card game where that is done.  But maybe in baccarat the word means
> something totally different.
>
> Naming difficulty, getPlayers() cannot reasonably be called more than once,
> so it's better named something like init_players().
>
> In class Card, your final else clause looks like a good place for assert().
>  It'll never happen in production, but only till the program has passed its
> test suite.
>
> In placeBets(), there doesn't seem to be any indication of which person
> (name) is betting each time.  That should probably be part of the prompt to
> raw_input.
>
> In   (), the raw_input() that's assigned to standordraw, it doesn't include
> the player name in the prompt. This is even more important than the last,
> since only a few of the players will get prompted like this each round.
>
> hope that helps some.
>
>
>
> --
>
> DaveA
>
Thanks for your reply.
Yes, you supposed correctly, I just wanted some advice to make it
clearer and cleaner. Thanks for your help, I know people here don't
have a lot of time and I appreciate that. That's all I wanted, really.
I'll try & make myself clearer next time.
Thanks again
Col


More information about the Tutor mailing list