Pen Plotting

Recently I’ve been into pen plotters – they hit the sweet spot of several venn diagrams: blending hardware & software, engineering & art, and randomness & structure. Basically they are at the convergence of things I enjoy

The process started with a blog post by Tobias Toft, found here. It was broken down in a way I could understand and immediately wanted to get more into.


A recent work

From there I got the hardware: I was able to find my own plotter — an HP 7550A in factory packaging from 1985. Finding cabling was a bit of trial and error but soon I had it talking to the computer


The HP7550A Plotter

The software aspect was trickier. After a year of futzing around someone who made things I liked recommended a video lecture series by Matt DesLauriers, found here. This made the seemingly impossible task look very possible — which made it worth the 40$ cost to me.

After that it was off to the races – I started with different pens, paper, frames and more.


This lets me use standard pens with the HP Plotter



I ended up making an instagram for these works — check it out here


Rock Climbing Tracker

Once upon a time, on youtube I saw a video showing off software like this:


I think its super cool. But the high cost (100 dollars a day) and fact that uses a 2D camera left me wanting to make my own.


With that, here is a demo of what I’ve made. Details after the video


  • Uses Kinect V2.0 Camera
  • Running on a Dell XPS Ultrabook thats ~2 years old
  • Standard lighting



Highlighting Holds:

This is where it highlights the holds, showing in the first few seconds of the video. It uses a grid every five pixels and will stop selecting if the color changes drastically

Tracking People:

This is the wireframe overlayed on me. This is done by Microsoft’s software

Detecting Human -> Hold Collisions:

This is done by tracking the human hand and checking it against the distance (one threshold) and depth (another threshold). If each are met, the hold is marked as “reached” and the color is changed.


Will upload software later — it needs to be refactored / cleaned up

Uploaded here. It still needs to be refactored / cleaned up

Do pitchers throw different pitches to batters that they’ve face more often?

In competitive events the more experience you have against a particular opponent means the more information they have about how you play and vis versa. As this knowledge increases certain tools become more and less valuable.

For example, consider facing a knuckleball pitcher in baseball. Knowing they will throw knuckleballs a majority of the time and not being as familiar with their release motion means sneaking a fastball in can really catch you off guard. Then, as you learn how these pitches look the unexpected fastball becomes more predictable and, therefore, less valuable.

Does the data support this theory?

Sort of – it depends on the pitchers. Here are the pitches thrown to players based on how many pitches total they threw to that batter for pitchers that had notable results:

R.A. Dickey_figure.png

R.A. Dickey seems to reduce the number of fastballs and increase knucklers if hes faced you often


Chris Sale seems to replace four seam fastballs with two seems fastballs with repeat visits


Jake Arrieta uses more sinkers and sliders and less fourseamers and curves

To get this data I took information from PITCHf/x from Brooks Baseball and then used pandas in python to form the graphs. Here is the source code to check out other players

Do you have any insight as to why some pitches scale better? Let me know in the comments below

A Circular Conundrum

Another week, another riddler. This weeks:

From Keith Wynroe, a concise circular conundrum:

If N points are generated at random places on the perimeter of a circle, what is the probability that you can pick a diameter such that all of those points are on only one side of the newly halved circle?

What a cool problem. First, I wanted to restate the problem so it could be evaluated more easily. I came up with finding the maximum difference in angle between two points. If this value is greater than 180 deg then you can draw a diameter in there that would satisfy this criteria.

Now how do we figure out how often this criteria is met? First, lets assume that one point is always at 0 (we can achieve this by rotating our circle). The same point is also at 360 degrees. Then there are N-1 points that will be located on the rest of our circle

For N=3 this would look like:



This is what it may look like after the points are placed. However, before points B & C are placed we have


If we place B & C and both are 180 deg or further from A1 then our layout would pass the test (shown in yellow). This is our first condition for creating a passing circle. For this experiment lets say we don’t and we place B between 0 and 180 degrees and instead get something like this:


Now, if we placing C and its greater than 180 degrees larger than B or less than B it would pass the test (shown in yellow). This is our second condition. Lets again say we don’t place it there and get something like this:


This brings us to our final condition, if all points are 180 deg or greater from A2. In this case they are, so our circle passes the test.

Reviewing: our conditions are

1: All points are 180 deg away from A1.

Probability (1/2)^(N-1)

2: All points are 180 deg away from B.

Probability (1/2)^(N-1)

3: All points are 180 deg away from A2.

Probability (1/2)^(N-1)

Because these are independent we can sum them and get the chance of success as 75 for N = 3. Generalizing, we get:


The only thing that changes with an increased number of points is that there are more “Condition 2″s for each additional point – which gives you the N value on

A FiveThirtyEight Spelling Bee

Another week, another riddler. This weeks:


From Steven Pratt, ordinal bee probability:

You are competing in a spelling bee alongside nine other contestants. You can each spell words perfectly from a certain portion of the dictionary but will misspell any word not in that portion of the book. Specifically, you have 99 percent of the dictionary down cold, and your opponents have 98 percent, 97 percent, 96 percent, and so on down to 90 percent memorized. The bee’s rules are simple: The contestants take turns spelling in some fixed order, which then restarts with the first surviving speller at the end of a round. Miss a word and you’re out, and the last speller standing wins. The bee words are chosen randomly from the dictionary.

First, say the contestants go in decreasing order of their knowledge, so that you go first. What are your chances of winning the spelling bee? Second, say the contestants go in increasing order of knowledge, so that you go last. What are your chances of winning now?


Unfortunately I had to just brute for this one. Due to the nature of the problem I couldn’t think of a good way to put this into any sort of an equation. Here are the results:



import random
import matplotlib.pyplot as plt
import matplotlib.patches as patches

def play_round(player):
    return random.randint(0,99) > player

def play_game():
    players = [1 for i in range(1,11)]
    players_left = sum(players)

    player_up = 0
    while players_left > 1:
        if players[player_up]:
            if not play_round(player_up):
                players[player_up] = 0
        player_up = (player_up + 1) % len(players)
        players_left = sum(players)
    return players.index(1)

#Run cycles

winners = [0 for i in range(1,11)]
for cycles in range(100000):
    winner = play_game()
    winners[winner] += 1
    if (cycles%10000 == 0): print(winners)

## Configure for plotting

percents = [float(winners[i])/cycles for i in range(len(winners))]
players_for_plotting = [99-i for i in range(10)]

fig = plt.figure()
ax1 = fig.add_subplot(111)

ax1.scatter(players_for_plotting,old_percents, color='purple',label ='best player first')
plt.ylabel('% wins')
plt.title('538 Spelling Bee Expected Results')
plt.legend(loc = 1)

Pannin for Pangrams Pt II

Four years ago I wrote part one of Panning for Pangrams. I looked through about a million tweets looking for a new pangram (think “The quick brown fox jumps over the lazy dog”). My goal was to find out if someone has accidentally tweeted a more efficient pangram — basically an applied infinite monkey theory.

If you didn’t read the initial post don’t worry, here are the rules:

  1. The tweet cannot include a username (@BuildABarr for example) or url (
  2. The tweet gets 9 points for each unique alphabetical character. This incentives including more of the alphabet
  3. The tweet gets -1 point for each repeated character or non-whitespace character. This means numbers or symbols hurt the score. This incentives coherence
  4. I get veto power. I really only used this on people who tweeted the entire alphabet because I guess thats a thing

I then searched 9m tweets from this database: Below are some tweets that score well:

with 24 characters for 188 points


with 24 characters for 193 points


with 24 characters for 195 points


So there is lots of room for improvement!

Code here:

<pre>import pandas as pd
import matplotlib.pyplot as plt
import os, time, re

path = os.path.normpath("D:/test_set_tweets.txt")

def run_data_logger():
    max_points = 0

    with open(path, "r", errors='ignore') as fp: #strips away non-utc chars
        for line in fp:
            line_data = line.split("\t")
            if len(line_data) &gt; 2:
                text = line_data[2]
                tweet = text

                if text.find("http:") is not -1 or text.find("@") is not -1: text = ""
                text = text.upper() #uppercase all to avoid doubling up

                text = re.sub('[ ]', "", text) #destroy spaces

                char_count = len(text)
                text = ''.join(set(text)) #remove repeated letters
                text = re.sub('[^A-Za-z]', "", text) #delete non-characters

                points = 9*len(text) -1*(char_count-len(text))

                if points &gt; 185 and len(text) &gt;= 23:
                    print("Points: ",points," chars: ", len(text)," Max tweet: ",tweet)


Sum to 15 Card Game

Another week, another riddler. This week’s:

From John Hanna, a different kind of “card” game:

You and I are playing a game. It’s a simple one: Spread out on a table in front of us, face up, are nine index cards with the numbers 1 through 9 on them. We take turns picking up cards and putting them in our hands. There is no discarding.

The game ends in one of two ways. If we run out of cards to pick up, the game is a draw. But if one player has a set of three cards in his or her hand that add up to exactly 15 before we run out of cards, that player wins. (For example, if you had 2, 4, 6 and 7, you would win with the 2, 6 and 7. However, if you had 1, 2, 3, 7 and 8, you haven’t won because no set of three cards adds up to 15.)

Let’s say you go first. With perfect play, who wins and why?


This one is pretty fun. Here is how I looked at it:


Imagining that each player can see into the future, they will take the option that maximizes their outcome. Therefore my plan was to find the end result of every hand (9! or ~400,000 outcomes). Then, go up a level — when the player had to decide between the two outcomes they would pick the one that gives them the best result. You do this again and again, flipping who gets to choose between the options and therefore which direction they are optimizing for.

At the end of this we see that the players will result in a tie every time.


Continue reading