Skip to content

Commit ac71da6

Browse files
author
allendowney
committed
Updated color_list.py
1 parent a6ed775 commit ac71da6

24 files changed

Lines changed: 845 additions & 369 deletions

Makefile

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11

22
FILES = \
3-
AmoebaWorld.py Gui.py lumpy_test3.py readwrite.py turtle_code.py\
4-
CellWorld.py Lumpy.py lumpy_test.py Sync.py TurtleWorld.py\
5-
coke.py lumpy_test2.py mutex.py TurmiteWorld.py World.py\
6-
danger.gif words.txt
7-
8-
VERSION = swampy.1.4
3+
AmoebaWorld.py lumpy_example2.py TurmiteWorld_test.py\
4+
AmoebaWorld_test.py lumpy_example3.py turtle_code.py\
5+
CellWorld.py Lumpy.py TurtleWorld.py\
6+
CellWorld_test.py Lumpy_test.py TurtleWorld_test.py\
7+
Gui.py mutex.py World.py\
8+
Gui_test.py Sync.py World_test.py\
9+
__init__.py Sync_test.py\
10+
lumpy_example1.py TurmiteWorld.py \
11+
danger.gif words.txt
12+
13+
VERSION = swampy-2.1
914
DEST = /home/downey/public_html/swampy
1015

16+
all:
17+
cd python2; make python3
18+
cd python2; make pydoc
19+
cd python3; make pydoc
20+
1121
setup:
1222
python setup.py sdist --formats=zip
1323

14-
all: zip2 zip3 zipdoc dist
15-
16-
dist:
17-
cp $(VERSION).python2.zip $(DEST)
18-
cp $(VERSION).python3.zip $(DEST)
19-
cp $(VERSION).doc.zip $(DEST)
20-
21-
two2three:
22-
cd python2; make python3
23-
24-
zip2:
24+
zip:
2525
mkdir $(VERSION)
26+
mkdir $(VERSION)/sync_code
2627
cd python2; cp $(FILES) ../$(VERSION)
28+
cd python2; cp sync_code/*.py ../$(VERSION)/sync_code
2729
zip -r $(VERSION).python2.zip $(VERSION)
28-
rm -rf $(VERSION)
29-
30-
zip3:
30+
rm -rf $(VERSION)
3131
mkdir $(VERSION)
32-
cd python3; cp $(FILES) ../$(VERSION)
32+
cd python3; cp -r $(FILES) ../$(VERSION)
3333
zip -r $(VERSION).python3.zip $(VERSION)
3434
rm -rf $(VERSION)
3535

36+
distrib:
37+
cp python2/*.html $(DEST)
38+
cp dist/swampy-*.zip swampy-*.zip $(DEST)
39+
3640
DIR = swampy.1.4.doc
3741
zipdoc:
3842
mkdir $(DIR)

python2/AmoebaWorld.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def __init__(self, world=None):
159159
self.size = 0.5
160160
self.color1 = 'violet'
161161
self.color2 = 'medium orchid'
162+
self.tag = 'Amoeba%d' % id(self)
162163

163164
def move(self, x, y):
164165
"""Moves the amoeba and redraws."""
@@ -173,7 +174,6 @@ def draw(self):
173174
thetas = range(0, 360, 30)
174175
coords = self.poly_coords(self.x, self.y, thetas, self.size)
175176

176-
self.tag = 'Amoeba%d' % id(self)
177177
slime = 'lavender'
178178

179179
# draw the slime outline which will be left behind

python2/CellWorld_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def test_cell_world(self):
2020
self.assertTrue(cell is got)
2121

2222
neighbors = cw.get_four_neighbors(cell)
23-
self.assertEquals(len(neighbors), 4)
23+
self.assertEqual(len(neighbors), 4)
2424

2525
neighbors = cw.get_eight_neighbors(cell)
26-
self.assertEquals(len(neighbors), 8)
26+
self.assertEqual(len(neighbors), 8)
2727

2828
cw.rescale()
2929

python2/Gui_test.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_gui(self):
1616
gui = Gui.Gui()
1717
fr = gui.fr()
1818
endfr = gui.endfr()
19-
self.assertEquals(gui, endfr)
19+
self.assertEqual(gui, endfr)
2020

2121
row = gui.row()
2222
gui.rowweights([1,2,3])
@@ -26,7 +26,7 @@ def test_gui(self):
2626

2727
popfr = gui.popfr()
2828

29-
self.assertEquals(popfr, row)
29+
self.assertEqual(popfr, row)
3030

3131
en = gui.en()
3232

@@ -60,61 +60,61 @@ def test_gui(self):
6060
def test_options(self):
6161
d = dict(a=1, b=2, c=3)
6262
res = Gui.pop_options(d, ['b'])
63-
self.assertEquals(len(res), 1)
64-
self.assertEquals(len(d), 2)
63+
self.assertEqual(len(res), 1)
64+
self.assertEqual(len(d), 2)
6565

6666
res = Gui.get_options(d, ['a', 'c'])
67-
self.assertEquals(len(res), 2)
68-
self.assertEquals(len(d), 2)
67+
self.assertEqual(len(res), 2)
68+
self.assertEqual(len(d), 2)
6969

7070
res = Gui.remove_options(d, ['c'])
71-
self.assertEquals(len(d), 1)
71+
self.assertEqual(len(d), 1)
7272

7373
d = dict(side=1, column=2, other=3)
7474
options, packopts, gridopts = Gui.split_options(d)
75-
self.assertEquals(len(options), 1)
76-
self.assertEquals(len(packopts), 1)
77-
self.assertEquals(len(gridopts), 1)
75+
self.assertEqual(len(options), 1)
76+
self.assertEqual(len(packopts), 1)
77+
self.assertEqual(len(gridopts), 1)
7878

7979
Gui.override(d, side=2)
80-
self.assertEquals(d['side'], 2)
80+
self.assertEqual(d['side'], 2)
8181

8282
Gui.underride(d, column=3, fill=4)
83-
self.assertEquals(d['column'], 2)
84-
self.assertEquals(d['fill'], 4)
83+
self.assertEqual(d['column'], 2)
84+
self.assertEqual(d['fill'], 4)
8585

8686

8787
def test_bbox(self):
8888
bbox = Gui.BBox([[100, 200], [300, 500]])
89-
self.assertEquals(bbox.left, 100)
90-
self.assertEquals(bbox.right, 300)
91-
self.assertEquals(bbox.top, 200)
92-
self.assertEquals(bbox.bottom, 500)
89+
self.assertEqual(bbox.left, 100)
90+
self.assertEqual(bbox.right, 300)
91+
self.assertEqual(bbox.top, 200)
92+
self.assertEqual(bbox.bottom, 500)
9393

94-
self.assertEquals(bbox.width(), 200)
95-
self.assertEquals(bbox.height(), 300)
94+
self.assertEqual(bbox.width(), 200)
95+
self.assertEqual(bbox.height(), 300)
9696

9797
# TODO: upperleft, lowerright, midright, midleft, center, union
9898

9999
t = bbox.flatten()
100-
self.assertEquals(t[0], 100)
100+
self.assertEqual(t[0], 100)
101101

102102
pairs = [pair for pair in Gui.pairiter(t)]
103-
self.assertEquals(len(pairs), 2)
103+
self.assertEqual(len(pairs), 2)
104104

105105
seq = Gui.flatten(pairs)
106-
self.assertEquals(len(seq), 4)
106+
self.assertEqual(len(seq), 4)
107107

108108
def test_point(self):
109109
point = Gui.Point([100, 200])
110-
self.assertEquals(point.x, 100)
111-
self.assertEquals(point.y, 200)
110+
self.assertEqual(point.x, 100)
111+
self.assertEqual(point.y, 200)
112112

113113
def test_canvas(self):
114114
gui = Gui.Gui()
115115
ca = gui.ca()
116-
self.assertEquals(ca.width, 100)
117-
self.assertEquals(ca.height, 100)
116+
self.assertEqual(ca.width, 100)
117+
self.assertEqual(ca.height, 100)
118118

119119
point = [50, 50]
120120
box = [[100, 200], [300, 500]]

0 commit comments

Comments
 (0)