<div dir="ltr">On Wed, Apr 20, 2016 at 3:58 PM, Carl Karsten <span dir="ltr"><<a href="mailto:carl@nextdayvideo.com" target="_blank">carl@nextdayvideo.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>I also don't show real code right away.  I scribble on the white board.<br><br></div></div></div></blockquote><div><br></div><div>Yeah, I think we're just talking about different points along the journey.<br><br></div><div>I'm fine with Blueprint and/or Cookie Cutter at first, as the predominant metaphor, and not too much code.<br><br></div><div>But then in my code school boot camp model they might have 12 weeks x 40 hours to learn all this JavaScript -> Other Language -> Python -> JavaScript (they go round and round in a spiral in this curriculum).<br><br></div><div>So down the road a ways, when it's important to understand more of the Python grammar, I might move away from Blueprint and Cookie Cutter to MotherShip and AmusementPark.<br><br></div><div>[ The version below keeps statistics at the class level (turnstyles...). ]<br><br></div><div>I like your relating programming to processing video.  <br><br>I'm working to forge that connection more explicitly myself.  The idea of "frames" (as in time frames, frames of file, intervals of action) figures in.<br><br></div><div>Kirby<br><br></div><div><br># -*- coding: utf-8 -*-<br>"""<br>Created on Wed Apr 20 16:44:44 2016<br><br>@author: Kirby Urner<br>Carnival Guy (aka "geek", luvs chicken)<br><br>version 0.2<br>(copyleft) MIT License<br><br>"""<br>import random<br><br>class Blech(Exception):<br>    pass<br><br>class AmusementPark:  # euphemism for carnival<br>    ferris_riders = 0<br>    coaster_riders = 0<br>    riders_born = 0<br>    <br>    @classmethod<br>    def report(A):<br>        return "Ferris rides: {}\nCoaster rides: {}\nRiders: {}".\<br>            format(A.ferris_riders, A.coaster_riders, A.riders_born)<br>   <br>    @classmethod<br>    def ferris_wheel(A, me):<br>        A.ferris_riders += 1<br>        me.sick = False<br>        return me<br>       <br>    @classmethod<br>    def roller_coaster(A, me):<br>        A.coaster_riders += 1<br>        # moral: don't eat before riding the roller coaster<br>        if len(me.stomach) > 0:<br>            me.sick = True    # sick state persists<br>            me.stomach = []  # ... this should help though<br>        return me<br>       <br>    @classmethod<br>    def make_rider(A):<br>        A.riders_born += 1<br>        return A()<br>   <br>    def __init__(self):  # born to ride<br>        self.stomach = []<br>        self.sick = False<br>       <br>    def __call__(self, food): # born to eat<br>        if self.sick:<br>            raise Blech("too sick to eat")<br>        self.stomach.append(food)<br><br>    def __repr__(self):<br>        if self.sick:<br>            return "I don't feel so good"<br>        else:<br>            return "I feel fine"<br>   <br><br>A1 = AmusementPark<br>alice = A1.make_rider()  # a child of her profession<br>bob = A1.make_rider()<br>carl = A1.make_rider()<br><br>def time_frame():<br>    while True:<br>        rider = random.choice([alice, bob, carl])<br>        ride = random.choice([A1.ferris_wheel, A1.roller_coaster])<br>        ride(rider)<br>        yield A1<br><br>frame = time_frame()        <br>for time_tick in range(10):<br>    next(frame)<br>    <br>print(A1.report())<br><br><br></div></div></div></div>