Example #1
0
def main():
    
    p1 = Point()
    p2 = Point()
    p1.x = 0
    p1.y = 0
    p2.x = 3
    p2.y = 4.5
    print distance_between_points(p1, p2)
    
    lumpy = Lumpy()
    lumpy.make_reference()

    box = Rectangle()
    box.width = 100.0
    box.height = 200.0

    box.corner = Point()
    box.corner.x = 0.0
    box.corner.y = 0.0

    print 'move'
    box2 = move_rectangle2(box, 50, 100)
    print box2.corner.x
    print box2.corner.y

    lumpy.object_diagram()
class Dog:
    #
    # create a Lumpy object
    lumpy = Lumpy()
    # capture reference state
    lumpy.make_reference()

    a = 10
    b = 20

    def __init__(self, name, color):
        self.name = name
        self.color = color

    def speak_identity(self, name):
        print(self.name)
        print(self.color)
        print(self)
        print(name)

    # draw the current state (relative to the reference state)
    lumpy.object_diagram()
Example #3
0
"""

import copy

from lumpy_demo import *

from swampy.Lumpy import Lumpy

class Point(object):
    """Represents a point in 2-D space."""

class Rectangle(object):
    """Represents a rectangle."""

lumpy = Lumpy()
lumpy.make_reference()

box = Rectangle()
box.width = 100.0
box.height = 200.0
box.corner = Point()
box.corner.x = 0.0
box.corner.y = 0.0

lumpy.class_diagram()
print_diagram(lumpy, 'lumpydemo7.eps')



Example #4
0
# github/pythink
# ex611.py

from swampy.Lumpy import Lumpy

def b(z):
	prod = a(z, z)
	print z, prod
	return prod
	
def a(x, y):
	x = x + 1
	return x * y
	
def c(x, y, z):
	total = x + y + z
	square = b(total)**2
	return square

lumpy = Lumpy()
lumpy.make_reference()
	
x = 1
y = x + 1
print c(x, y+3, x+y)
Example #5
0
"""

from swampy.Lumpy import Lumpy


def b(z):
    prod = a(z, z)
    print z, prod
    return prod


def a(x, y):
    x = x + 1
    lumpy.object_diagram()
    return x * y


def c(x, y, z):
    total = x + y + z
    square = b(total)**2
    return square


lumpy = Lumpy()
lumpy.make_reference()

x = 1
y = x + 1
print c(x, y + 3, x + y)
Example #6
0
"""This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com

Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html

"""

from lumpy_demo import *

from swampy.Lumpy import Lumpy

lumpy = Lumpy()
lumpy.make_reference()

cheeses = ['Cheddar', 'Edam', 'Gouda']
numbers = [17, 123]
empty = []

lumpy.object_diagram()
print_diagram(lumpy, 'lumpydemo3.eps')

Example #7
0
"""

import copy

from lumpy_demo import *

from swampy.Lumpy import Lumpy


class Point(object):
    """Represents a point in 2-D space."""


class Rectangle(object):
    """Represents a rectangle."""


lumpy = Lumpy()
lumpy.make_reference()

box = Rectangle()
box.width = 100.0
box.height = 200.0
box.corner = Point()
box.corner.x = 0.0
box.corner.y = 0.0

lumpy.class_diagram()
print_diagram(lumpy, 'lumpydemo7.eps')