Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-31 Thread Kent Johnson
Dick Moores wrote: > At 03:49 AM 10/30/2007, Kent Johnson wrote: >> From here to simple classes is not a big step: >> >> class player(object): >> def __init__(self, name, moveCounter, remainingTime): >> self.name = name >> self.moveCounter = moveCounter >> self.remainingTime = remaini

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-31 Thread Dick Moores
At 03:49 AM 10/30/2007, Kent Johnson wrote: >Dick Moores wrote: > 2. I've used 1 for White player, -1 for Black player, and (-1)*player to alternate players. Is there a better way? 3. I've used a lot of variables. Too Many? >>> >>>I think it might work well to either put the player vari

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-30 Thread Dick Moores
At 03:49 AM 10/30/2007, Kent Johnson wrote: >Why do you need to call kbhit() at all? Why not just call getch() >and wait for the next character? Like this?: . The every-5-seconds time report doesn't report. Compare =

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-30 Thread bob gailer
I also encourage you to jump into classes. Yes there is a learning curve. It is IMHO worth it. Borrowing from Kent Johnson: class Player(object): def __init__(self, name, moveCounter, remainingTime): self.name = name self.moveCounter = moveCounter self.remainingTime = remaining

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-30 Thread Kent Johnson
Dick Moores wrote: >>> 2. I've used 1 for White player, -1 for Black player, and (-1)*player >>> to alternate players. Is there a better way? >>> 3. I've used a lot of variables. Too Many? >> >> I think it might work well to either put the player variables into >> lists or simple classes. > > I

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 06:38 PM 10/29/2007, Kent Johnson wrote: Dick Moores wrote: 1. Is wrapping the long lines where I have done so OK? I usually indent the second line of a wrapped line so it stands out more. Done in newest version 10 < http://www.rcblue.com/Python/chessTimerForWebV10.py> 2. I've used 1 for Whit

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > 1. Is wrapping the long lines where I have done so OK? I usually indent the second line of a wrapped line so it stands out more. > 2. I've used 1 for White player, -1 for Black player, and (-1)*player > to alternate players. Is there a better way? > 3. I've used a lot of vari

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
I've developed chessTimer a bit further: I'm still hoping for some constructive criticism. But I also thought I'd mention again the points I have doubts about: 1. Is wrapping the long lines where I have done so OK? 2. I've used 1 for White play

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Eric Brunson
Dick Moores wrote: > At 07:54 AM 10/29/2007, Eric Brunson wrote: > >> Dick Moores wrote: >> >>> At 05:03 AM 10/29/2007, bhaaluu wrote: >>> >>> On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > Seems I should clarify that. I'm not looking for a script t

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 01:13 AM 10/27/2007, Alan Gauld wrote: >Take a look at my Event Driven programming topic. It contains a >simple key echo program using msvcrt and instructions for Linux >users to convert it to use curses. > > From that you should be able to create a dual platform version. Alan, I'm afraid I was

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 07:54 AM 10/29/2007, Eric Brunson wrote: >Dick Moores wrote: >>At 05:03 AM 10/29/2007, bhaaluu wrote: >> >>>On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: >>> Seems I should clarify that. I'm not looking for a script that echoes the key pressed. So I'll change that last line to "Cou

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Eric Brunson
Dick Moores wrote: > At 05:03 AM 10/29/2007, bhaaluu wrote: > >> On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: >> >>> Seems I should clarify that. I'm not looking for a script that echoes >>> the key pressed. So I'll change that last line to "Could you show a >>> script using it that,

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 05:03 AM 10/29/2007, bhaaluu wrote: >On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > Seems I should clarify that. I'm not looking for a script that echoes > > the key pressed. So I'll change that last line to "Could you show a > > script using it that, say, prints "Hello" if '1' is pres

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread bhaaluu
On 10/29/07, Dick Moores <[EMAIL PROTECTED]> wrote: > Seems I should clarify that. I'm not looking for a script that echoes > the key pressed. So I'll change that last line to "Could you show a > script using it that, say, prints "Hello" if '1' is pressed and > "Bye" if '2' is, AND uses >

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > At 03:44 AM 10/29/2007, Kent Johnson wrote: >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 > > Kent, I'm still too dumb to see how to use that. Could you show a > script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? from getch_recipe imp

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 04:08 AM 10/29/2007, Dick Moores wrote: >At 03:44 AM 10/29/2007, Kent Johnson wrote: > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 > >Kent, I'm still too dumb to see how to use that. Could you show a >script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? Se

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread bhaaluu
# tty-example-2.py # Tue Oct 19 09:07:14 CEST 1999 # Fredrik Lundh fredrik at pythonware.com # http://mail.python.org/pipermail/python-list/1999-October/014151.html import sys try: # windows or dos import msvcrt getkey = msvcrt.getch except ImportError: # assume unix import tty

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Dick Moores
At 03:44 AM 10/29/2007, Kent Johnson wrote: >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 Kent, I'm still too dumb to see how to use that. Could you show a script using it that, say, prints 1 if '1' is pressed and 2 if '2' is? Thanks, Dick __

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-29 Thread Kent Johnson
Dick Moores wrote: > OK, here's a short script, which runs fine on Windows. What do I add > to have it run on unix as well? > > #!/usr/bin/env python > #coding=utf-8 > > try: > # windows or dos > import msvcrt > while True: > if msvcrt.kbhit(): > key = msvcrt

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-27 Thread Dick Moores
At 01:13 AM 10/27/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > OK, here's a short script, which runs fine on Windows. What do I add > > to have it run on unix as well? > >Take a look at my Event Driven programming topic. It contains a >simple key echo program using msvcrt

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-27 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > OK, here's a short script, which runs fine on Windows. What do I add > to have it run on unix as well? Take a look at my Event Driven programming topic. It contains a simple key echo program using msvcrt and instructions for Linux users to convert it to

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Dick Moores
At 05:00 AM 10/26/2007, bhaaluu wrote: >Greetings, > >On 10/26/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 09:33 AM 10/25/2007, Dick Moores wrote: > > >Please give me constructive criticism of > > > > > > > Hmm. Nothing. One problem may be t

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > I certainly think this is something that Newbies (like myself) > should learn. > But without a MS-Windows computer handy, I don't know? Is there a > place that has this information? The Module documentation tells you which platforms are supported. But its m

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread bhaaluu
Greetings, On 10/26/07, Dick Moores <[EMAIL PROTECTED]> wrote: > At 09:33 AM 10/25/2007, Dick Moores wrote: > >Please give me constructive criticism of > > > > Hmm. Nothing. One problem may be that only people using Windows can > run the script.

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-26 Thread Dick Moores
At 09:33 AM 10/25/2007, Dick Moores wrote: >Please give me constructive criticism of > Hmm. Nothing. One problem may be that only people using Windows can run the script. I've developed chessTimer a bit further:

Re: [Tutor] Looking for suggestions - update

2005-11-15 Thread Kent Johnson
->Terry<- wrote: > Today (Nov 15, 2005) at 6:08am, Kent Johnson spoke these wise words: > - ->- I think you missed my earlier suggestion about simplifying get_button(). > > I tried your suggestion for changing get_button() and > changed it to: > > def get_button(click): # What pe

Re: [Tutor] Looking for suggestions - update

2005-11-15 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Today (Nov 15, 2005) at 6:08am, Kent Johnson spoke these wise words: - ->->Terry<- wrote: - ->> Thanks for the reply Kent and others. I've made some - ->> changes and the game is quite playable now. I've put - ->> the new version online at the same

Re: [Tutor] Looking for suggestions - update

2005-11-15 Thread Kent Johnson
->Terry<- wrote: > Thanks for the reply Kent and others. I've made some > changes and the game is quite playable now. I've put > the new version online at the same links if anyone > wants to take a look. A few more ideas: - I think you missed my earlier suggestion about simplifying get_button().

Re: [Tutor] Looking for suggestions - update

2005-11-14 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Today (Nov 14, 2005) at 6:10am, Kent Johnson spoke these wise words: - ->A couple of notes after a quick look: - -> - ->- As you note, def check_valid_jump(sel1, sel2) is really ugly. When I have code like this I look for a way to drive it from a ta

Re: [Tutor] Looking for suggestions

2005-11-14 Thread Kent Johnson
->Terry<- wrote: > Now here is the perhaps silly question. Is > something like this need to have a license? > What I mean is, as I play with and improve > this game and want to share it with others, > should I choose a license and add the legal > stuff with the distributed product? Just a quick no

Re: [Tutor] Looking for suggestions

2005-11-14 Thread Kent Johnson
->Terry<- wrote: > To anyone willing to take the time to have a > look at the code and offer any advice or > suggestions, I would be much appreciative. > I'm looking for code suggestions rather than > game-play suggestions, although I'm open to > any help. A couple of notes after a quick look: -

Re: [Tutor] Looking for suggestions

2005-11-14 Thread R. Alan Monroe
> To anyone willing to take the time to have a > look at the code and offer any advice or > suggestions, I would be much appreciative. I'm wondering if you can condense this: if sel1 == 1 and sel2 == 4: # This seems really ugly... if state[1] == 1: return 2 el

Re: [Tutor] Looking for suggestions

2005-11-14 Thread Johan Geldenhuys
Haven't look at the code in detail, but it would be great exercise to write a web gui for this game like the one for Tick-Tack-Toe. Any suggestions where to start with something like this? Johan PS: Fun to play. ->Terry<- wrote: >-BEGIN PGP SIGNED MESSAGE- >Hash: SHA1 > > >I have writ