Ahem. This is a newsgroup/mailing list, not IM. I happen to have seen this within half an hour of you posting it, but that's just luck. Expecting an "immediate" response is unrealistic.

Furthermore, this is comp.lang.python, a group right up there in pedantry terms with cam.misc. Wandering in and demanding "immediate" help is just begging for half a dozen replies that give you detailed and mind-boggling versions of exactly what you asked for, especially if it's got nothing to do with the answer you actually need.

So...

On Wed, 09 Dec 2009 23:55:01 -0000, Daniel <dkeepe...@yahoo.com> wrote:

i am making a tic-tac-toe game using python. i am pretty new to it,
but cant seem to figure this one out.
Here is my code:

X = "X"
O = "O"
empty = " "
tie = "Tie"
squares = 9

There's a convention (PEP 8, why not go to www.python.org and read it?) that constants should be given names in CAPITAL_LETTERS_AND_UNDERSCORES so that you can tell at a glance that they aren't supposed to be changed. PEP 8 also has things to say about function names.

[snip rest of program]

Here is my problem:
If you hit 'n' at the beginning prompt, the computer does four moves
automatically and wins- you can't input anything.

Sounds like you have a bug in your end-of-turn function. To be fair, it took me a couple of minutes to be sure I'd spotted this correctly.

If you hit 'y' at
the beginning prompt, you can play but cannot win. I got three x's in
a row and it didn't let me win. It just keeps letting
you input numbers until the computer wins even if you have three in a
row.

Sounds like you have a bug in your check-for-a-win function. That should be all the hint you need.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to