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: