human
I found an interesting problem on https://www.codewars.com/kata/5657d8bdafec0a27c800000f:
### The Problem

Consider a flat board with pegs sticking out of one side. If you stretched a rubber band across the outermost pegs what is the set of pegs such that all other pegs are contained within the shape formed by the rubber band?

![alt text](https://upload.wikimedia.org/wikipedia/commons/b/bc/ConvexHull.png)

More specifically, for this kata you will be given a list of points represented as ```[x,y]``` co-ordinates. Your aim will be to return a sublist containing points that form the perimeter of a polygon that encloses all other points contained within the original list.

### Notes:

The tests may include duplicate and/or co-linear points. Co-linear points are a set of points which fall on the same straight line. Neither should be included in your returned sublist

For simplicity, there will always be at least 3 points

### Help:

Check out wikipedia's page on [convex hulls](https://en.wikipedia.org/wiki/Convex_hull)

```if:python
Note for python users: `scipy` module has been disabled.
```

I tried it in Python, but could not do it. Can you solve it?

Can you provide a the set of pegs such that all other pegs are contained within the shape formed by the rubber band?
assistant
#Here is the set of pegs such that all other pegs are contained within the shape formed by the rubber band.

import math

# Check for left turns in constant time
def is_ccw_turn(p0, p1, p2):
    return (p1[0] - p0[0]) * (p2[1] - p0[1]) - (p2[0] - p0[0]) * (p1[1] - p0[1]) > 0

"""
Iteratively generate a hull by finding items with the maximum distance from the current hull, adding them, and repeating.
Currently very inefficient.
"""
def quickhull(points):
    
    def dist(a, b, c):
        A = b[1]-a[1]
        B = a[0]-b[0]
        C = a[1]*b[0]-a[0]*b[1]
        return abs(A*c[0]+B*c[1]+C)
    
    def triangle_area(a, b, c):
        return a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1])
    
    def quickhull_recurse(a, b, targets, indent=1):
        # Remove colinear points
        targets = [p for p in targets if dist(a, b, p) != 0]
        # If no targets exist, be done
        if len(targets) == 0:
            return []
        max_dist = max([dist(a, b, p) for p in targets])
        m = min([p for p in targets if dist(a, b, p) == max_dist])
        l_targets = quickhull_recurse(a, m, [p for p in targets if not is_ccw_turn(m, a, p)], indent+1)
        r_targets = quickhull_recurse(m, b, [p for p in targets if not is_ccw_turn(b, m, p)], indent+1)
        return l_targets + [m] + r_targets
    
    # Grab two extreme points
    least, most = min(points), max(points)
    # Split into those points above and below
    points = [p for p in points if p != most and p != least]
    top = quickhull_recurse(least, most, [p for p in points if is_ccw_turn(least, most, p)])
    bot = quickhull_recurse(most, least, [p for p in points if not is_ccw_turn(least, most, p)])
    # Generate the final result
    return [least] + top + [most] + bot

"""
Generate a merged hull by splitting the hull arbitrarily, generating two parting hulls, and reconciling.
First, remove all points in hull 2's inner edge, if the centroid of hull 1 is outside hull 2.
Then, reconcile all points into a single queue, ordered by angle, then distance.
Finally, run a graham scan on this new monotone ring.
DOESN'T CURRENTLY RUN TOO...