Now that I have gotoxy() down for moving the cursor around, I want that
to be a result of keypresses (namely from the numpad -- 7 = NorthWest,
8 = North, 9 = NE, etc...). I have little clue how to do this. After
searching google, I've come upon this; include:
import curses
in the header. Howev
OK - I added the import WConio line. But when I run
import WConio
print "going to x10,y10..."
WConio.gotoxy(10,10)
print "Done"
the above, I get the following error:
WConio.gotoxy(10,10)
error: GetConOut Failed
I installed the WConio to the ../site-packages/ folder in Python24, and
when it did
Thanks -- I downloaded WConio.
When I just tried it out in the IDLE, it said:
NameError: name 'WConio' is not defined
I assume I have to use a header somewhere (import WConio ?). Or is
there something I'm missing (I downloaded the Python 2.4 (I have 2.4.2)
auto installer and it ran fine...)
--
Is there some command in python so that I can read a key's input and
then use a gotoxy() function to move the cursor on screen? e.g.:
(psuedo-code)
When the right arrow is pushed, cursor gotoxy(x+1,y)
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
How do I 'define' set? Is there something to include (like import
random)?
while (choice == 3) and len(set(cellboard[0:8]))==len(cellboard[0:8]):
# DEFINE TWO RANDOM VARIABLES (ONE FOR ARRAY, ONE FOR NUMBER
VALUE)
solvingrandom = random.randint(1,9)
cellboardrandom = rando
For the
not cellboard[0] in cellboard[1:8] (I knew about ranges/slicing using a
colon, can't believe I didn't think of that!)
line, will I have to write that out for each number?
So the line:
not cellboard in ((cellboard[1:8]) and (cellboard[9] and cellboard[18]
and cellboard[27] and cellboard[
Another question: I am writing a sudoku solving program. The
'solving' part of is just multiple iterations. It will take random
numbers and keep switching it all around until a set of logic
statements has been met (ie; all numbers in a row are not equal to each
other) ... that's where my questio
The code's indentation was fine - I forgot to declare cell in player
two's section and not just in player one.
The code (including the win check, for once!) is working. The last
obstacle is my tie checker; it doesn't seem to like what I have:
if ((gameboard[0:9] is 'X' or 'O') and (win == 0)):
Nevermind my previous reply: I've been fixing up the code and
understand it. I'm at a nifty 80 lines where I am at now rather than
209 lines in the previous version! The changes are immense!
The only problem I have is whenever player two goes, it says the cell
is filled. But the code:
if gameb
So is there a way I have to set up the string OX in the beginning? Is
this where it houses the location of the Xs and Os to determine whether
or not a letter is already there?
--
http://mail.python.org/mailman/listinfo/python-list
Thank you. It seems I didn't understand logic statements as much as I
thought I did!
The one remaining question I have deals with this:
if gameboard[cell] not in 'OX':
gameboard[cell] = 'O'
else:
print "This cell is already filled."
turnnumber -= 1
(gameboard[cell]
Greetings! I am trying to make a multiplayer (no AI, 2 person) game of
tic tac toe in Python. So far it has been pretty simple. My only
concern is with the win checking to see if a person has won. At first
it looked like it was working, but now it sometimes assigns a win when
you enter an X or
12 matches
Mail list logo