[stdlib-sig] A game in the standard library

Mark Summerfield list at qtrac.plus.com
Sat Aug 18 10:32:29 CEST 2012


On Fri, 17 Aug 2012 22:11:40 -0400
"R. David Murray" <rdmurray at bitdance.com> wrote:
> On Fri, 17 Aug 2012 18:33:58 -0700, Ned Deily <nad at acm.org> wrote:
> > In article 
> > <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw at mail.gmail.com>,
> >  Brett Cannon <brett at python.org> wrote:
> > > Wrong tense as the Demos directory got nuked in Python 3.2.
> > 
> > Rather than being totally nuked in 3.2, didn't the old Demos directory 
> > just get pruned and cleaned up and then moved to underneath the Tools 
> > directory as Tools/demo?
> 
> Yes.
> 
> Not only that, but there are already some tkinter demos, though they
> are not games.

I have Perl/Tk versions of snake and tetris that're ~1500 LOC. If I
dropped the handling of options and made them all constants (board size,
timing interval, board colors, etc.) that would take them down to ~950
LOC.

I would be happy to port one of them to Python/Tkinter and I'm pretty
sure I could reduce the size even further without compromising on
readability.

I also have a Python/Tkinter version of tilefall (samegame) that's ~1200
LOC, but again, if I made all the options constants & did some other
simplifications to the GUI I could easily get that down to ~800 LOC or
less.

Or maybe the person who suggested adding a game to Tools/demo already
has their own game in mind:-)

PS I notice that in Tools/demo for 3.3b02 redemo.py doesn't have
execute permissions but all the others do.

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Rapid GUI Programming with Python and Qt" - ISBN 0132354187
            http://www.qtrac.eu/pyqtbook.html


More information about the stdlib-sig mailing list