Resizer: A Simple Video Game Without Member or Global Variables

I made a very simple video game about a green circle avoiding red arrows for my “Art of Graphics Programming Class”. I was given the constraint to avoid using member and global variables, and to do everything in Cinder’s draw loop. As such, the game isn’t able to save the state of enemies or the player in a normal way. Instead I use sine functions to determine enemy positions, and the width of the application window to alter the player’s location. Also, as a consequence of everything being in the draw loop, the game just quits when you lose. You can check out a quick video of the game below, download it here (mac only) and browse the full code on GitHub.

[vimeo w=640]

Some Shit Other Than Guns And Tanks That Police Departments Get From The Pentagon


The New York times recently did an interactive piece on the militarization of the police, revealing what equipment police departments across the country receive from the Pentagon. I did a quick analysis of the raw files from the Times (which they kindly posted on GitHub) to see what items were most popular nationwide. The top 10 items police departments received, in total, are:

  • 146,866 cartridge magazines
  • 119,067 electrical wires
  • 61,548 rifles (these are 5.56 millimeter assault rifles)
  • 54,805 cold weather shirts
  • 43,828 socket head cap screws
  • 43,638 field packs
  • 36,787 reflex sights
  • 36,617 ammunition chests
  • 35,290 elastic bandage kits
  • 21,313 industrial goggles

And of course there are plenty of tanks, aircraft, and body armor in there as well, ready to be deployed at a moment’s notice in suburban wherever.

The Pentagon however, supplies much more than military-grade nightmare gear. According to the list they are also distributing the following items:

  • 31 armoires
  • 1 money counter
  • 6 french horns and 1 euphonium
  • 179 assorted lawn mowers
  • 271 assorted treadmills
  • 72 golf carts and 1 order of golf balls
  • 2 pizza ovens
  • 37 kitchen spatulas, 35 laboratory spatulas, and 3 dental spatulas
  • 71 dessert spoons, 82 tea spoons, and 12 picnic spoons
  • 30 shower curtain hooks
  • 1 pair of cotton underwear
  • 1252 laundry bags
  • 1 recumbent exercise bike
  • 39 scooters
  • 5809 wet weather poncho liners
  • 2 food carrying carts
  • 17 dish towels
  • 23 soccer balls
  • 3 fishing boats, 19 kayaks, and 7 canoes
  • 10 men’s pajama trousers
  • 4758 neckerchiefs
  • 1 santa’s uniform
  • 1 simulated suicide bomber vest
  • 4 black rain coats
  • 3 “slaving” accessories (I’m hoping this is a typo)
  • 1 bouncy castle w/ blower (what was the Pentagon doing with a bouncy castle in the first place?)

As the Times notes, “this data does not represent all of the military-style gear that law enforcement agencies have. Agencies also purchase equipment with their own money or with federal grants.” It’s a distinct possibility that there’s more than one police department with a bouncy castle out there, inhabited, I hope, by a santasuit-wearing cop holding an assault rifle in one hand and a dental spatula in the other.

Videogrep: Automatic Supercuts with Python

Videogrep is a python script that searches through dialog in videos and then cuts together a new video based on what it finds. Basically, it’s a command-line “supercut” generator. The code is here on github.

The script searches through a video’s associated subtitle file (which needs to be in the same folder as the video, in standard .srt format), identifies timestamps for the dialog, and then uses the wonderful moviepy library to generate the new final cut.

Here’s one of the results: every instance of a character saying the word “time” in the movie In Time (a film whose dialog appears to consist mostly of clock-related puns).

The script also works with multiple video files in the same directory. As an experiment, I mass downloaded press briefings from the Whitehouse youtube channel, then ran a word-level n-gram analysis on the subtitle tracks to find some commonly used phrases. I discovered that the phrase “what I can tell you” is occurs pretty frequently.

So, here is Jay Carney, the former Press Secretary, telling us what he can tell us. Note the necktie transitions.

You may have noticed some strange cuts in the above video. The accuracy of the edits is completely reliant on the accuracy of the subtitle tracks.

You can also use videogrep to find instances of people employing specific grammatical structures (I do this with the pattern library). For example, by running the following command

I end up with a video of TED speakers saying “[gerund] [determiner] [adjective] [noun]”

As I final experiment, I wrote a complimentary script that finds dialog-free sections of videos. Here, for example, is “Total Silence”: all the one to two second silences in the movie Total Recall.

Feel free to mess around with the script on github, and let me know if you have any suggestions for source material to run through it.