dblume/pizza-slice

View on GitHub
README.md

Summary

Maintainability
Test Coverage
[![Code Climate](https://codeclimate.com/github/dblume/pizza-slice/badges/gpa.svg)](https://codeclimate.com/github/dblume/pizza-slice)
[![Issue Count](https://codeclimate.com/github/dblume/pizza-slice/badges/issue_count.svg)](https://codeclimate.com/github/dblume/pizza-slice/issues)
[![License](https://img.shields.io/badge/license-MIT_license-blue.svg)](https://raw.githubusercontent.com/dblume/pizza-slice/main/LICENSE)
![python2.x](https://img.shields.io/badge/python-2.x-yellow.svg)

# Dividing the Last Pizza Slice

Drag left and right on the pizza slice at the [**Last Pizza Slice**](http://pizza.dlma.com).  Notice how the the straight horizontal cut that evenly divides the pizza moves up and down a little?  That's it. That's all this website does. We're done here.

## Origin

My middle-school-aged son asked me how one would cut such a slice of pizza, given that it was a 14-inch pizza, and it had eight slices, so each slice's angle, θ, was 45°.

Want to solve it yourself? Stop reading, spoilers follow:

![shortcut](https://raw.githubusercontent.com/dblume/pizza-slice/main/images/pizzaslice.png)

It took me longer than it should have to figure it out. I knew it'd be possible, but my trigonometry was rusty.

![shortcut](https://raw.githubusercontent.com/dblume/pizza-slice/main/images/pizza-scribbles-small.jpg)

Of course, having eventually solved the simple problem, I began to suspect that the location of the cut would move subtly if you vary the angle of the slice. Obviously, that calls for an open-source website, and here we are.

## Even More Interesting: When θ > 1.9 radians

Once θ grows to be over 1.9 radians the problem became more interesting [and I had some trouble coming to a solution](https://www.facebook.com/photo.php?fbid=10154042850971561&set=a.10150887996666561.410585.687611560&type=3&theater). The shapes of the two halves require more complicated math.

Being confronted with that challenge was irresistable.

## Is it any good?

[Yes](https://news.ycombinator.com/item?id=3067434).