A game in the standard library

What do you guys think about including a very simple game with the standard library? My very first lines of code were modifications to a QBasic game called "nibbles" which came with QBasic. A memory dear to my heart and CV. The world has changed and nowadays it's much easier to download whatever, though I think this would still be useful for our younger downloaders: * As a reason to poke and tinker around c:\python33\Lib\ or /usr/lib/python3.3/ * To give a simple, sample Tk app. * "import turtle" is nice but at 4K lines, we can do simpler. Also, as a game it's mainly interesting for a very young demographic I believe. * A simple, fun, readable, moddable, Tk game is possible at 200-400 lines or about 10KB of uncompressed code. * As another neat "Python is fun" example, à la "import antigravity" Yuval Greenfield

Yuval Greenfield wrote:
What do you guys think about including a very simple game with the standard library?
Great idea !
My very first lines of code were modifications to a QBasic game called "nibbles" which came with QBasic. A memory dear to my heart and CV. The world has changed and nowadays it's much easier to download whatever, though I think this would still be useful for our younger downloaders:
* As a reason to poke and tinker around c:\python33\Lib\ or /usr/lib/python3.3/ * To give a simple, sample Tk app. * "import turtle" is nice but at 4K lines, we can do simpler. Also, as a game it's mainly interesting for a very young demographic I believe. * A simple, fun, readable, moddable, Tk game is possible at 200-400 lines or about 10KB of uncompressed code. * As another neat "Python is fun" example, à la "import antigravity"
-- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Aug 16 2012)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2012-08-25: FrOSCon, St. Augustin, Germany ... 9 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/

On Thu, Aug 16, 2012 at 7:38 AM, Yuval Greenfield <ubershmekel@gmail.com>wrote:
What do you guys think about including a very simple game with the standard library?
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
My very first lines of code were modifications to a QBasic game called "nibbles" which came with QBasic. A memory dear to my heart and CV. The world has changed and nowadays it's much easier to download whatever, though I think this would still be useful for our younger downloaders:
* As a reason to poke and tinker around c:\python33\Lib\ or /usr/lib/python3.3/ * To give a simple, sample Tk app.
That does screw over OS X users since their version of Tk by default is crap unless you also provide a non-GUI version. -Brett C.
* "import turtle" is nice but at 4K lines, we can do simpler. Also, as a game it's mainly interesting for a very young demographic I believe. * A simple, fun, readable, moddable, Tk game is possible at 200-400 lines or about 10KB of uncompressed code. * As another neat "Python is fun" example, à la "import antigravity"
Yuval Greenfield
_______________________________________________ stdlib-sig mailing list stdlib-sig@python.org http://mail.python.org/mailman/listinfo/stdlib-sig

Am 16.08.2012 17:43, schrieb Brett Cannon:
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
Isn't it obvious to you? We are talking about Python! There is just one mini game that fits: http://en.wikipedia.org/wiki/Snake_%28video_game%29 Yuval has mentioned Nibbles in his initial posting. Nibbles was a Snake clone in QBasic that was shipped with MS DOS. Christian

Le jeudi 16 août 2012 à 20:31 +0200, Christian Heimes a écrit :
Am 16.08.2012 17:43, schrieb Brett Cannon:
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
Isn't it obvious to you? We are talking about Python! There is just one mini game that fits:
http://en.wikipedia.org/wiki/Snake_%28video_game%29
Yuval has mentioned Nibbles in his initial posting. Nibbles was a Snake clone in QBasic that was shipped with MS DOS.
The main issue IMHO is that snake was a well-known gaming reference in the 80s/early 90s, but it's not nowadays. Perhaps a "demonstration game in the stdlib" should mimick one of the popular games of today (a simple one obviously, not World of Warcraft :-)). Regards Antoine. -- Software development and contracting: http://pro.pitrou.net

On Thu, Aug 16, 2012 at 2:34 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Le jeudi 16 août 2012 à 20:31 +0200, Christian Heimes a écrit :
Am 16.08.2012 17:43, schrieb Brett Cannon:
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
Isn't it obvious to you? We are talking about Python! There is just one mini game that fits:
http://en.wikipedia.org/wiki/Snake_%28video_game%29
Yuval has mentioned Nibbles in his initial posting. Nibbles was a Snake clone in QBasic that was shipped with MS DOS.
The main issue IMHO is that snake was a well-known gaming reference in the 80s/early 90s, but it's not nowadays. Perhaps a "demonstration game in the stdlib" should mimick one of the popular games of today (a simple one obviously, not World of Warcraft :-)).
Nah, that's no fun. =) Plus the game is simple enough that those who don't know it can pick it up quickly. Regardless, we do have to make sure the game is dead-simple to implement so the code and be clean and easy to read.

Am 16.08.2012 20:40, schrieb Brett Cannon:
Nah, that's no fun. =) Plus the game is simple enough that those who don't know it can pick it up quickly.
Regardless, we do have to make sure the game is dead-simple to implement so the code and be clean and easy to read.
Plus we should avoid to get a PG or R rating for Python. ;) Another bonus for a a simple game with simple graphics like Snakes: it's easily possible to create an interface for ncurses and TK. Christian

On 08/16/2012 08:34 PM, Antoine Pitrou wrote:
Le jeudi 16 août 2012 à 20:31 +0200, Christian Heimes a écrit :
Am 16.08.2012 17:43, schrieb Brett Cannon:
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
Isn't it obvious to you? We are talking about Python! There is just one mini game that fits:
http://en.wikipedia.org/wiki/Snake_%28video_game%29
Yuval has mentioned Nibbles in his initial posting. Nibbles was a Snake clone in QBasic that was shipped with MS DOS.
The main issue IMHO is that snake was a well-known gaming reference in the 80s/early 90s, but it's not nowadays. Perhaps a "demonstration game in the stdlib" should mimick one of the popular games of today (a simple one obviously, not World of Warcraft :-)).
Angry Birds is clearly the answer :-). Anyway, I guess such a game would belong more into the Demo directory? Cheers, Carl Friedrich

In article <CAP1=2W5h9QUKvNJjrw-bez-N92rpxxCp5qNO=oL6Wko90oPFAQ@mail.gmail.com>, Brett Cannon <brett@python.org> wrote:
On Thu, Aug 16, 2012 at 7:38 AM, Yuval Greenfield <ubershmekel@gmail.com>wrote:
What do you guys think about including a very simple game with the standard library? So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
My very first lines of code were modifications to a QBasic game called "nibbles" which came with QBasic. A memory dear to my heart and CV. The world has changed and nowadays it's much easier to download whatever, though I think this would still be useful for our younger downloaders:
* As a reason to poke and tinker around c:\python33\Lib\ or /usr/lib/python3.3/ * To give a simple, sample Tk app.
That does screw over OS X users since their version of Tk by default is crap unless you also provide a non-GUI version.
* "import turtle" is nice but at 4K lines, we can do simpler. Also, as a game it's mainly interesting for a very young demographic I believe. * A simple, fun, readable, moddable, Tk game is possible at 200-400 lines or about 10KB of uncompressed code. * As another neat "Python is fun" example, a la "import antigravity"
Not that there shouldn't be more but what about python3 -m turtledemo ? That gives easy access to the source to a number of game-like demos in a simple and elegant interface. (And it works fine on OS X with that "crap" Tk, using ActiveTcl.) http://docs.python.org/py3k/library/turtle.html#demo-scripts -- Ned Deily, nad@acm.org

On Thu, Aug 16, 2012 at 6:43 PM, Brett Cannon <brett@python.org> wrote:
On Thu, Aug 16, 2012 at 7:38 AM, Yuval Greenfield <ubershmekel@gmail.com>wrote:
What do you guys think about including a very simple game with the standard library?
So this is the kind of thing that would lead to arguments about "what game?" The general concept works for me, though if something can be agreed upon.
My very first lines of code were modifications to a QBasic game called "nibbles" which came with QBasic. A memory dear to my heart and CV. The world has changed and nowadays it's much easier to download whatever, though I think this would still be useful for our younger downloaders:
* As a reason to poke and tinker around c:\python33\Lib\ or /usr/lib/python3.3/ * To give a simple, sample Tk app.
That does screw over OS X users since their version of Tk by default is crap unless you also provide a non-GUI version.
-Brett C.
I installed virtual box and OS X just to test this and a Tk nibbles clone I made seems to work fine. I tested also on Windows7 and Ubuntu 12.04. https://raw.github.com/ubershmekel/nibbles/master/nibbles.py So I'm not sure what you mean by "screw over OS X users". Yuval

Frankly I'm against the idea of any type of *application* in the stdlib proper. The stdlib exists to support writing other programs. It should not contain self-contained programs (some testing utilities excepted). I'm totally fine with adding a game to the Demos directory in the distro -- that's what it's for. -- --Guido van Rossum (python.org/~guido)

On Fri, Aug 17, 2012 at 10:42 AM, Guido van Rossum <guido@python.org> wrote:
Frankly I'm against the idea of any type of *application* in the stdlib proper. The stdlib exists to support writing other programs. It should not contain self-contained programs (some testing utilities excepted).
I'm totally fine with adding a game to the Demos directory in the distro -- that's what it's for.
Wrong tense as the Demos directory got nuked in Python 3.2.

Oh well, the first paragraph stands. :) --Guido van Rossum (sent from Android phone) On Aug 17, 2012 9:02 AM, "Brett Cannon" <brett@python.org> wrote:
On Fri, Aug 17, 2012 at 10:42 AM, Guido van Rossum <guido@python.org>wrote:
Frankly I'm against the idea of any type of *application* in the stdlib proper. The stdlib exists to support writing other programs. It should not contain self-contained programs (some testing utilities excepted).
I'm totally fine with adding a game to the Demos directory in the distro -- that's what it's for.
Wrong tense as the Demos directory got nuked in Python 3.2.

On Fri, Aug 17, 2012 at 1:34 PM, Guido van Rossum <guido@python.org> wrote:
Oh well, the first paragraph stands. :)
Yep, so I consider the idea dead. -Brett
--Guido van Rossum (sent from Android phone) On Aug 17, 2012 9:02 AM, "Brett Cannon" <brett@python.org> wrote:
On Fri, Aug 17, 2012 at 10:42 AM, Guido van Rossum <guido@python.org>wrote:
Frankly I'm against the idea of any type of *application* in the stdlib proper. The stdlib exists to support writing other programs. It should not contain self-contained programs (some testing utilities excepted).
I'm totally fine with adding a game to the Demos directory in the distro -- that's what it's for.
Wrong tense as the Demos directory got nuked in Python 3.2.

In article <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw@mail.gmail.com>, Brett Cannon <brett@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? -- Ned Deily, nad@acm.org

On Fri, 17 Aug 2012 18:33:58 -0700, Ned Deily <nad@acm.org> wrote:
In article <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw@mail.gmail.com>, Brett Cannon <brett@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. --David

On Fri, 17 Aug 2012 22:11:40 -0400 "R. David Murray" <rdmurray@bitdance.com> wrote:
On Fri, 17 Aug 2012 18:33:58 -0700, Ned Deily <nad@acm.org> wrote:
In article <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw@mail.gmail.com>, Brett Cannon <brett@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

Mark Summerfield wrote:
On Fri, 17 Aug 2012 22:11:40 -0400 "R. David Murray" <rdmurray@bitdance.com> wrote:
On Fri, 17 Aug 2012 18:33:58 -0700, Ned Deily <nad@acm.org> wrote:
In article <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw@mail.gmail.com>, Brett Cannon <brett@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:-)
Please note that we cannot add games to Python for which the owners of the IP claim copyrights, patents or trademarks. Tetris is one such game. Tic-tac-toe would be a good example of a popular game (even if simplistic) that does not have such problems (http://en.wikipedia.org/wiki/Tic-tac-toe). It's also simple enough to demonstrate writing such games in Python. Snake would work as well, since the company owning the IP closed down in 1984 (http://en.wikipedia.org/wiki/Snake_%28game%29). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Aug 18 2012)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2012-08-25: FrOSCon, St. Augustin, Germany ... 7 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/

On Sat, Aug 18, 2012 at 11:32 AM, Mark Summerfield <list@qtrac.plus.com>wrote:
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:-)
I don't know how'd we decide which game to include. Most things on these lists are decided by popular vote or BDFL intervention. But perhaps we should charter candidates from outside the mailing lists, it could be a fun contest and publicity stunt. I'd say under 1000 pep8 lines, and choose a winner or two by votes for readability and fun by the mailing list frequenters or BDFL. I say 1K as it shouldn't really be a full game with cinematic intro and outro but more of a fun tech demo that a novice could wrap their head around. Yuval p.s. concerning the snake - I have created a 2-player, 270 line, Tk version https://github.com/ubershmekel/nibbles

On Sat, Aug 18, 2012 at 5:11 AM, R. David Murray <rdmurray@bitdance.com>wrote:
On Fri, 17 Aug 2012 18:33:58 -0700, Ned Deily <nad@acm.org> wrote:
In article <CAP1=2W6eSDbP9W6EZWP7=PuYy8pa8Dg+MA1SyJ35LEwQOZ_zZw@mail.gmail.com>, Brett Cannon <brett@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 found Tools/demo in the hg tree but it wasn't installed on windows for me. I'm guessing it was just never included in cpython\Tools\msi\msi.py for some reason. Yuval
participants (10)
-
Antoine Pitrou
-
Brett Cannon
-
Carl Friedrich Bolz
-
Christian Heimes
-
Guido van Rossum
-
M.-A. Lemburg
-
Mark Summerfield
-
Ned Deily
-
R. David Murray
-
Yuval Greenfield