예제 #1
0
    def step(self):
        """Performs one time step."""
        TurtleWorld.step(self)
        
        # compute average turtle speed
        total = 0.0
        for turtle in self.animals:
            total += turtle.speed

        print total / len(self.animals)
예제 #2
0
 def __init__(self):
     TurtleWorld.__init__(self)
     self.rows = 2.0
     self.delay = 0.01
     self.colors = color_list.make_color_dict().values()
예제 #3
0
#!/usr/bin/python

"""
This module is part of Swampy, a suite of programs available from
allendowney.com/swampy.

Copyright 2005 Allen B. Downey
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.

"""

import World
from TurtleWorld import TurtleWorld, Turtle

import Lumpy
lumpy = Lumpy.Lumpy()
lumpy.opaque_class(World.Interpreter)
lumpy.make_reference()

world = TurtleWorld()
bob = Turtle(world)

lumpy.object_diagram()
lumpy.class_diagram()