1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
diff -urN Genetic-0.1.1.orig/demo/demo_circle.py Genetic-0.1.1/demo/demo_circle.py
--- Genetic-0.1.1.orig/demo/demo_circle.py 2006-07-15 12:39:09.000000000 -0700
+++ Genetic-0.1.1/demo/demo_circle.py 2006-07-15 12:39:26.000000000 -0700
@@ -6,6 +6,8 @@
# MutableOrderList extends the Mutable class and can be used as a value for a
# gene, instead of a float or anything. Here we call this list "order"
+from __future__ import nested_scopes
+
def journey_distance(order):
# order is : [first_city, second_city, ...]
return reduce(operator.add, map(lambda cityA, cityB: math.sqrt((cityA.x - cityB.x) ** 2 + (cityA.y - cityB.y) ** 2), order, order[1:] + [order[0]]))
@@ -21,7 +23,6 @@
This demo search the smaller circle that contains all the given points.
"""
-from __future__ import nested_scopes
import random, string, math, Tkinter
from genetic import organism, lifecycle
|