From 0782d0098c85c0daf432b4e83eb0fcb594adc53e Mon Sep 17 00:00:00 2001 From: smortime Date: Thu, 4 Feb 2016 14:38:16 -0700 Subject: [PATCH 1/3] Completed assignment --- point_pattern.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/point_pattern.py b/point_pattern.py index 9ae56ee..1f0be85 100644 --- a/point_pattern.py +++ b/point_pattern.py @@ -27,7 +27,7 @@ def manhattan_distance(a, b): distance : float The Manhattan distance between the two points """ - distance = None # Add the algorithm to compute manhattan distance here + distance = abs(a[0]-b[0]) + abs(a[1]-b[1])# Add the algorithm to compute manhattan distance here return distance @@ -49,7 +49,7 @@ def euclidean_distance(a, b): distance : float The Euclidean distance between the two points """ - distance = None # Add the euclidean distance algorithm here + distance = math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2) # Add the euclidean distance algorithm here return distance @@ -87,8 +87,8 @@ def shift_point(point, x_shift, y_shift): x = getx(point) y = gety(point) - x_new = None # Add the logic to shift x here - y_new = None # Add the logic to shift y here + x_new = x + x_shift # Add the logic to shift x here + y_new = y + y_shift # Add the logic to shift y here return x_new, y_new @@ -109,7 +109,7 @@ def check_coincident(a, b): equal : bool Whether the points are equal """ - return None # Add the logic to check if coincident here + return a == b # Add the logic to check if coincident here def check_in(point, point_list): @@ -124,7 +124,7 @@ def check_in(point, point_list): point_list : list in the form [point, point_1, point_2, ..., point_n] """ - return None # Add the logic to check if a point is in the point list here + return point in point_list # Add the logic to check if a point is in the point list here def getx(point): From 678798bbedfc1e12dad9c60e059dd394c13f1a37 Mon Sep 17 00:00:00 2001 From: smortime Date: Thu, 4 Feb 2016 14:46:08 -0700 Subject: [PATCH 2/3] Added a .travis.yml file --- tests/.travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/.travis.yml diff --git a/tests/.travis.yml b/tests/.travis.yml new file mode 100644 index 0000000..9aa63d2 --- /dev/null +++ b/tests/.travis.yml @@ -0,0 +1,6 @@ +language: python +python: + - "3.5" + +#command to run tests +script: nosetests From 800c7d3734dc4cf3c31ec0c7f8d9a985d7683580 Mon Sep 17 00:00:00 2001 From: smortime Date: Thu, 4 Feb 2016 14:58:01 -0700 Subject: [PATCH 3/3] Test, moving travis file --- tests/.travis.yml => .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/.travis.yml => .travis.yml (100%) diff --git a/tests/.travis.yml b/.travis.yml similarity index 100% rename from tests/.travis.yml rename to .travis.yml