Homework help requested (not what you think!)

Discussion in 'Python' started by John Ladasky, Jul 16, 2013.

  1. John Ladasky

    John Ladasky Guest

    Hi folks,

    No, I'm not asking for YOU to help ME with a Python homework assignment!

    Previously, I mentioned that I was starting to teach my son Python.

    https://groups.google.com/d/msg/comp.lang.python/I7spp6iC3tw/8lxUXfrL-9gJ

    He just took a course at his high school called Web Technology and Design. They had the students use tools like Dream Weaver, but they also hand-coded some HTML and JavaScript. He has a little experience. I am building on it.

    Well, a few other parents caught wind of what I was doing with my son, and they asked me whether I could tutor their kids, too. I accepted the jobs (for pay, actually).

    The kids all claim to be interested. They all want to write the next great3D video game. Thus, I'm a little surprised that the kids don't actually try to sit down and code without me prompting them. I think that they're disappointed when I show them how much they have to understand just to writea program that plays Tic Tac Toe.

    Where programming is concerned, I'm an autodidact. I started programming when I was twelve, with little more guidance than the Applesoft Basic manualand the occasional issue of Byte Magazine. I hacked away. Over the years, I have acquired a working knowledge of BASIC, 6502 assembly language, Pascal, C, and finally Python (my favorite). If I knew how to impart a love of experimentation to my students, I would do that.

    One kid looks like he's ready to forge ahead. In the mean time, one parenthas recognized his son's lack of independence, and has asked me to assign programming homework. I hope it doesn't kill the kid's enthusiasm, but I'mwilling to try it.

    So, what I am seeking are suggestions for programming assignments that I can give to brand-new students of Python. Please keep in mind that none of them are even up to the task of a simple algorithm like Bubble Sort -- at least, not yet.

    Many thanks!
     
    John Ladasky, Jul 16, 2013
    #1
    1. Advertisements


  2. The disillusionment of every novice programmer, I think. It starts out
    as "I want to learn programming and make a game". Real programming is
    more like "I can automate mundane tasks", which doesn't sound half as
    exciting. But this is why I'm dubious of programming courses that
    actually try to hold onto the "let's make a game" concept, because the
    students are likely to get a bit of a let-down on realizing that it
    really doesn't work that easily ("this is a two-week course, at the
    end of it I should have written the next <insert name of popular game>
    for all my friends").

    ChrisA
     
    Chris Angelico, Jul 17, 2013
    #2
    1. Advertisements

  3. Not my siblings specifically, but I've seen this happen elsewhere quite a bit.

    Thing is, they still won't be making the next Call of Duty Black Ops,
    or Alice: Madness Returns, or even the next Angry Birds. It's like
    looking at the roads and how car manufacturers produce things that run
    from here to Sydney, and then learning how to build a go-kart with
    wooden wheels - strong disappointment in the scale of achievement.
    Which is a pity, because that go-kart can be a lot of fun; the novice
    programmer has to get past that disappointment and discover the other
    fun aspects of coding, like the ability to improve your own
    environment. (At work, one of my most useful oddments of code is a log
    tailing system that runs on each of N remote servers and effectively
    runs "tail -F foo.log" for each of M log files, tags the lines with
    the hostname and log file name, and sends it to a single display on my
    computer. Makes my job easier to the extent that I probably paid off
    the time investment within a week, but it's hardly glamorous stuff.)

    ChrisA
     
    Chris Angelico, Jul 17, 2013
    #3
  4. John Ladasky

    alex23 Guest

    One possible approach would be to pick existing games developed in
    PyGame and assist them to modify or extend them. This can be a lot less
    overwhelming than starting a game from scratch, and exposes them to the
    basic concepts such as the main event loop, separating out logic from
    display etc. Code reading is as valuable a skill as code writing.

    Another possibility is using a more extensive framework like Unity,
    which provides a lot of the toolchain to simplify the development
    process. While Unity doesn't support Python by default, it does provide
    Boo, which is Python-inspired. It's also built on top of the Mono
    framework, and I believe people have had some success with using .NET's
    IronPython with it.
     
    alex23, Jul 17, 2013
    #4
  5. I morn the death of Hypercard :(

    http://www.loper-os.org/?p=568

    Using Hypercard was like using Lego. You could literally copy and paste
    buttons from one app to another -- not code, the actual GUI button -- to
    copy their functionality.


    You could try Pythoncard:

    http://pythoncard.sourceforge.net/

    Alas, I don't think there is *any* system for GUI programming that comes
    even close to what is needed to keep the majority of new students
    interested. But you might have some success with text-based games. Here
    are two suggestions:

    - guess the number


    - twenty questions ("is it bigger than a breadbox?")




    You might also like to investigate Inform-7.

    http://inform7.com/
     
    Steven D'Aprano, Jul 17, 2013
    #5
  6. John Ladasky

    PythonAB Guest

    another vote for Unity here...
    We teach that at the filmschool here in Holland and it's a
    really well supported package.
    There's a free version and it "exports" to Windows, OSX,
    Linux, Playstation, XBOX, iPhone etc etc
    But that comes at the cost already mentioned by Alex above...
    http://en.wikipedia.org/wiki/Unity_(game_engine)
    http://unity3d.com/

    One step more advanced, but only available on Windows, is
    the CryEngine:
    http://en.wikipedia.org/wiki/Cryengine
    http://mycryengine.com/
    They also have a free version but again, no Python scripting
    by default.


    Another one to bring into attention may be Panda3D:
    http://www.panda3d.org/
    That has full Python support.

    Don't forget that all these engines require you to build your
    assets yourself, outside the engine.
    This means that you have to go into a 3D program like Blender
    to create characters, environments and creatures.

    greets
    Arno Beekman
     
    PythonAB, Jul 17, 2013
    #6

  7. As probably the youngest regular on this list (still not a kid any
    more though, as much as I would like to be) it's always been my
    experience that if you see someone young who says "I'm really
    interested in how to program!" they already either know a little (or a
    lot) or they're probably somewhat deluded. Programming's so easy to
    learn solo that if they haven't at least tried, they're just not as
    interested as they say ;).

    For homework I actually recommend reading assignments. Something that
    gets you straight there. When I taught a few people (back not that
    long ago to A-level [UK], once-a week lunchtime things) the first
    thing everyone went through were these:

    https://groups.google.com/forum/#!c...-matthew-arnold/help-for-lesson-1/cKy43xj56y4
    https://groups.google.com/forum/#!c...-matthew-arnold/help-for-lesson-2/iR6pMtsgFjA

    Note that I rather quickly stopped using the forum above, as with
    https://sites.google.com/site/learnhowtoprogram/, which I only really
    used to host code we needed (I got too lazy to update the rest,
    basically), so there's nothing else woth checking. I give you 100%
    free permission to steal anything of mine from those links, though.

    I'm no teaching expert, but these seemed to help people get the idea.
    The basic concept is that before you learn to write, you learn to
    read. If you give them well-documented (like, every line is
    documentation¹) code or something like the duo of links I posted above
    it will probably be a lot more meaningful than asking them to do
    something trivial they already know.

    I hear from a lot of people over teh netz that they learnt how to code
    from reading OSS. I personally didn't do most of my learning that way,
    but it doesn't mean that it doesn't work. The person from my lessons
    who learnt the most was the guy who of his own choice took some of the
    code we were working on and changed it at home without prompting to do
    something else. At the beginning there was no way he could write code
    that was marginally useful, and thus doing so would have been
    massively boring and discouraging -- giving him a platform he could
    work on made it much easier to do something useful.


    I hope I inspired a few thoughts, I'm not giving you the One True Way
    but these ideas should at least be blocks you can build with.

    ¹ See https://sites.google.com/site/learnhowtoprogram/Snake.py (which
    might have a purposeful bug in there, it's been a small while since I last
    ran it). That was for almost-new coders, with the aim of giving them
    something they originally could read but not really understand, and by
    gradually editing the code together they ended up getting it.
     
    Joshua Landau, Jul 17, 2013
    #7
  8. John Ladasky

    Neil Cerutti Guest

    One of the first satisfying programs I wrote as a child
    autodidact on my Commodore 64 was a random name generator. There
    are lots of workable strategies and the output can be fun.

    Hint: Putting together random syllables turned out to be much
    more fun than random consonants and vowels.

    Markov chains are an advanced technique you could introduce, but
    you'd need a huge list of names broken into syllables from
    somewhere.
     
    Neil Cerutti, Jul 17, 2013
    #8
  9. You could use names broken into letters... or skip the notion of names
    and just generate words. Lists of words are easy to come by (eg
    /usr/share/dict/words on many Linux systems), so you can have some fun
    without much effort.

    ChrisA
     
    Chris Angelico, Jul 17, 2013
    #9
  10. John Ladasky

    Neil Cerutti Guest

    That's true. Something like syllables should emerge from markov
    chains of letters pretty well, depending on how long the the
    chain is.
     
    Neil Cerutti, Jul 17, 2013
    #10
  11. I might have to hunt down my old Dissociated Press implementations,
    they were fun fun fun.

    ChrisA
     
    Chris Angelico, Jul 17, 2013
    #11
  12. John Ladasky

    Beth McNany Guest

    Thanks for this! I'm trying to put together something very similar right
    now for my younger brother, and this thread and associated links have been
    very helpful. He's taught himself enough Python to make a rudimentary text
    adventure game already, so the interest is definitely there. I'm hoping to
    sneak in some general CS concepts as well, although I'm concerned some
    things might be less obvious in Python. Also, I learned to program in PHP
    and Java before I learned Python (starting with a Django project), so I'm
    not sure how to start there... probably going to borrow some ideas from the
    intro level Java class I've been TA'ing.

    In my experience, people learn best via projects, so I've been trying to
    come up with some that are interesting, not too difficult, and focus on one
    or two main concepts. To be honest, I have no idea how realistic they are,
    because it's been a while since I first learned how to program and that
    wasn't even in Python. Offering it up here for your perusal / feedback
    (roughly in the order I'd do them):

    - text adventure: practice with stdlib, control flow, I/O. Lots of
    opportunities for embellishment here - create maps of rooms, load/save
    games by serializing into files or even a database, create status bars in
    the console, etc.

    - blackjack: a game with simple rules, you have to think about
    representation for the cards, and you can easily simulate a computer
    opponent. extra credit: graphical front-end that displays images for the
    cards.

    - sudoku checker/generator/solver: practice with lists, loops, logic,
    implementing algorithms. extra credit: design a solver yourself without
    looking up algorithms.

    - mandelbrot set app: math and graphics! can use this as an opportunity to
    introduce numpy/matplotlib, or DIY. (could be a bit esoteric depending on
    the student, though.)

    - game of life: simple graphics and update rules, fun to watch, source of
    the unofficial hacker emblem.

    - (extra credit?) simple chat program: this doesn't really fit the theme,
    but it's an introduction to networking / sockets, which could be useful.
    (and the intro class had lots of fun sending messages back and forth in
    class.)

    At this point, I'm hoping he'll be comfortable enough to begin working on a
    more complete game (most likely, using pygame, as he hasn't expressed much
    interest in 3D). Some ideas for classic/simple/well-defined games to try:
    - blob game (what is this one actually called? where the player absorbs
    smaller entities to grow but dies if he runs into a bigger entity)
    - tank battle (again, not sure on the name. two players, moving around,
    shooting at each other on a map with obstructions)
    - maze (bonus points for a maze generation algorithm)
    - snake
    - frogger
    - asteroids
    - etc.

    This doesn't include a lot of standard but less flashy stuff e.g. advanced
    data structures, graphs, sorting algorithms, because the idea was to find
    projects that would be tractable for someone just starting out and wanting
    to make fun things... but once they're hooked, you can explain how they're
    useful and start into those (at least, that's my theory). But you could
    still talk about things like classes, OO design, exception handling,
    recursion, complexity (especially with the sudoku project), as related to
    these projects.

    (As a side note, I'm a bit amused by the discussions about teaching "kids"
    specifically. When I was 17 I was a freshman enrolled in a Data Structures
    course, where I discovered that a course I took two years prior had already
    covered about 90% of the material...)

    -beth
     
    Beth McNany, Jul 17, 2013
    #12
  13. John Ladasky

    alex23 Guest

    I really wanted Dihedral to chime in here.
     
    alex23, Jul 18, 2013
    #13
  14. John Ladasky

    Aseem Bansal Guest

    You can use PySide/QtCreator for getting a skeleton UI as easily as in caseof Visual Studio. Converting it into .py files is also quite easy. Experiment a little for yourself in the beginning and you'll be able to make a simple Tic-Tac-Toe easily.

    You can then decide how complex that becomes. Remember that computer's behaviour just might be the most complex thing in this whole thing. You can then take that out, explain the students that the game will work if you can make a function for this, explain the logic and that can be a really nice homework assignment.

    I think that would be much better than just jumping off to a game engine sidetracking Python completely.

    If you want to introduce them to programming in general in a fun way http://scratch.mit.edu/ might be much easier for making simple 2D games. It isn'tPython but it is even better introduction to programming than Python(I am saying this even when I use Python everyday and I like it). Scratch isn't for long term but initially this could be their dose of excitement and introduction to the basics of programming. That would give you time to make simple games in PySide for taking them to Python gradually without killing their excitement.
     
    Aseem Bansal, Jul 18, 2013
    #14
  15. Now comes the Forth experience.

    I did the following experiment with a psychology student, who had
    never been exposed to computers and had no prior experience. He
    aquired a Jupiter Ace, which has Forth as a built in language. So his
    only exposure was to Forth. Now I started to teach him programming,
    using the cartoon book "starting Forth". Once in a weeek we sat
    together and worked through some exercises.

    After 6 weeks he surprised me. He had programmed the game pong
    which is a simple table tennis like game, where you have to
    keep a ball in play.
    He never gave me a a chance to prevent him having a traumatic experience
    of failure by telling him that was not a task a novice should start.
    Or for that matter that such any real time programming requires considerable
    up front planning and design.
    [This was an adult, and at the time university students in the
    Netherlands were certified intelligent and skilled and disciplined
    in learning.]

    The lesson that is in there for you is to not hold your students back.
    They may surprise you!

    Groetjes Albert
     
    Albert van der Horst, Jul 18, 2013
    #15
  16. John Ladasky

    Gene Heskett Guest

    I'll 2nd those thoughts, and tell 2 or 3 stories.

    When the Timex 1000 was new, I bought one for my kids and turned them loose
    with it. Within a week my 10 year old had composed a car graphic, and
    written a small program to drive it around on the screen.

    Back in a slightly newer time frame, Mr. Brodie's Forth, where you built
    your own extensions to the language, was used for a time at a small CA
    hospital as the hospitals accounting system, on a machine with only 64k of
    dram. A TRS-80 Color Computer we now call the old grey ghost.

    Fast forward 5 years from then, I wrote a program to work with a Grass
    Valley Group 300-3A/B television video switcher, which you could teach to
    do tricks, but it didn't have a means to save and reload them without
    buying a $20,000 EDISK accessory package.

    So I wrote one in Basic09, running on a Color Computer 2, still only 64k of
    dram, based on a copy of the com protocol that had come with the switcher
    when we had purchased it used from KTLA-TV. I wrote it on station time,
    and sold the station the hardware at about what it was worth at the time
    for a coco2 and 2 disk drives, $275. 14 years later as I was getting ready
    to retire and no one else knew that switcher, it was replaced, and my 'E-
    DISK' was no longer needed, so they gave it to me, so I still have it in my
    'coco' collection in the basement.

    Moral of course is never tell somebody it can't be done, he'll eat your
    lunch by doing it. Oh, BTW, mine was 4x faster, and instead of a 2 hex
    digit display for file names, gave the tech directors English filenames on
    a small video screen. They loved it because each one could then have his
    own personalized bag of video tricks to use during a news cast.


    Cheers, Gene
    --
    "There are four boxes to be used in defense of liberty:
    soap, ballot, jury, and ammo. Please use in that order."
    -Ed Howdershelt (Author)
    My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
    My views
    <http://www.armchairpatriot.com/What Has America Become.shtml>
    Syntactic sugar causes cancer of the semicolon.
    -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
    A pen in the hand of this president is far more
    dangerous than 200 million guns in the hands of
    law-abiding citizens.
     
    Gene Heskett, Jul 18, 2013
    #16
  17. John Ladasky

    Joseph Clark Guest

    Not to open Pandora's box or anything, but are you aware of the Roguelikecommunity (subculture?) (cult?) of game development? Rogue was an old "text-based" role playing game for Unix, "text-based" in the sense that it used the console as a 2D map and ASCII characters as graphics. There has been a sort of revival of the genre and a lot of amateur game developers havedone some simple or complex variations on the theme. They're not all RPGs.. The category is defined by a few commonalities like procedural content generation.

    There are very active forums and an extensive wiki. I think these might beparticularly appropriate fodder for a tutoring experience because they areneatly broken down into bite-sized chunks. One day you could do procedural map generation, another day AI, etc. And all these lessons generalize to the "professional" game development world.

    Look at this forum: http://forums.roguetemple.com/index.php?board=7.0
    This wiki: http://roguebasin.roguelikedevelopment.org/index.php?title=Main_Page
    This Python tutorial: http://roguebasin.roguelikedevelopm...lete_Roguelike_Tutorial,_using_python+libtcod

    By the way, I tried my hand at Markov chain name generation, too. My python code is at https://github.com/joeclark77net/jc77rogue/blob/master/program/namegen.py
    and what it does is read a corpus of names and generate new names that sound like that corpus. So you feed it a list of Roman names and it will give you fake names that sound Roman.

    // joseph w. clark , phd , visiting research associate
    \\ university of nebraska at omaha - college of IS&T
    ----------------------------------------
     
    Joseph Clark, Jul 18, 2013
    #17
  18. John Ladasky

    John Ladasky Guest

    Thanks to everyone for their wealth of suggestions. I already had my students playing with turtle. And I had asked them to alphabetize a string (without having previously revealed the sorted() function).

    So far, I have taken up the suggestion of the number-guessing game. One ofmy students has a working version. The logic is a bit clumsy, but it's a fine first attempt.

    I will also take up the Twenty Questions idea. My son and I played that game a lot over the years, to pass the time on long car rides. And it would be a great way to introduce the binary tree data structure.

    Another project I thought of was a Pig Latin translator. (But do kids today even know what Pig Latin is? Am I showing my age?)

    Concerning more advanced, real-time, game-oriented graphics, I am trying tofigure out how to build PyGame on top of Python3.x. Supposedly it is possible. I just haven't figured out how. It's 2013: I refuse to complicate my students' programming education with Python 2.x.

    I used wxPython happily for years, and I think that its graphical capabilities would probably be up to the task of a simple 2D game. Unfortunately, it has the same problem as PyGame, at least for now. The Py3-compatible version of wxPython, to be known as Phoenix, is still under development.

    I'll keep Unity, Panda3D, and Blender in mind for later. Again, one of my main concerns will be Python 3.x compatibility.
     
    John Ladasky, Jul 21, 2013
    #18

  19. Even if they don't, they'll grok it no problem. It's simple enough.

    ChrisA
     
    Chris Angelico, Jul 22, 2013
    #19
  20. John Ladasky

    Roy Smith Guest

    Igpay ythonpay!
     
    Roy Smith, Jul 22, 2013
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.