From a83dc20bab802cf6a8443f55ea5bd1e582103c49 Mon Sep 17 00:00:00 2001 From: AFRIKAKORPS1 Date: Tue, 9 Feb 2016 20:22:48 -0700 Subject: [PATCH 1/3] Create .travis.yml --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..89ffaf0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +yml +language: python +python: + - "3.5" + +#command to run tests +script: nosetests From cec39614170e4adddb471a7b913de69da3cd6ab9 Mon Sep 17 00:00:00 2001 From: AFRIKAKORPS1 Date: Tue, 9 Feb 2016 20:40:03 -0700 Subject: [PATCH 2/3] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 89ffaf0..9aa63d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -yml language: python python: - "3.5" From 02c15ca27622aecc674e0e8317e23e85546b03f7 Mon Sep 17 00:00:00 2001 From: AFRIKAKORPS1 Date: Tue, 9 Feb 2016 20:40:25 -0700 Subject: [PATCH 3/3] Update point_pattern.py --- point_pattern.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/point_pattern.py b/point_pattern.py index 9ae56ee..0ccf76c 100644 --- a/point_pattern.py +++ b/point_pattern.py @@ -1,5 +1,6 @@ import math # I am guessing that you will need to use the math module + """ Below are 5 functions (we will talk about what a function is later) that I have removed bits of @@ -27,10 +28,9 @@ 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 - def euclidean_distance(a, b): """ Compute the Euclidean distance between two points @@ -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 @@ -80,19 +80,18 @@ def shift_point(point, x_shift, y_shift): Example ------- - >>> point = (0,0) - >>> shift_point(point, 1, 2) + >> point = (0,0) + >> shift_point(point, 1, 2) (1,2) """ + 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 - def check_coincident(a, b): """ Check whether two points are coincident @@ -109,7 +108,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[0] == b[0] and a[1] == b[1] # Add the logic to check if coincident here def check_in(point, point_list): @@ -124,7 +123,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): @@ -145,7 +144,6 @@ def getx(point): """ return point[0] - def gety(point): """ A simple method to return the x coordinate of