Thursday, October 3, 2013

Arduino and Markov Chains (It sounds so fancy!)

What is an Arduino, Anyway?

I had heard of Arduino before and I knew it had something to do with setting up circuits and programing them to do things. But I had never used one or had much of a desire to try it out. Monday night we had an intro workshop at Hackbright on Arduino/circuits/electricity. Our team consists of five people, all Ravenclaws from Hackbright, and we got to take out an Arduino kit to play around with. In the kit is an Arduino board, which looks like this:

If you think it looks confusing and weird, join the club. But basically the little black box on the lower left corner is where you plug in a cable that connects to your computer so that you can tell the Arduino what to do.

The black lines across the top and bottom are little sockets where you can insert wires. So if you hook it up correctly, you can write a simple program that makes a tiny LED light blink on and off, at which point you can jump up and down and shout, "I made a robot!!!!!"


The kit also includes wires, LEDs, a motor, various sensors (temperature sensor, etc), and a breadboard, which is kind of like an extension of the Arduino in case you want to hook up more stuff. We have no idea what our project will be for the hackathon, but we might just play around with the Arduino for two days, see what we can make it do, and call that our project. It's not a super competitive hackathon. I predict I will learn a lot and have fun. And then our team gets to keep the Arduino kit forever! I envision a Hunger Games-style slaughterfest after which one of us walks away with an Arduino covered in the blood of our team members.

A Markov Success

The project we worked on on Tuesday to Wednesday was based on Markov chains, which sounds much fancier than it is, but is also a lot more fun than it sounds. Basically if we take a section of the most obnoxious Dr. Seuss book, we can see some patterns:

  "Would you could you in a house?
   Would you could you with a mouse?
   Would you could you in a box?
   Would you could you with a fox?"

In this text, the word "Would" is always followed by the word "you," but the word "you" might be followed by the word "could" or the word "in" or the word "with." We wrote a program that took a bunch of text and generated random sentences based on which words follow which words from that text. Naturally, my partner and I chose Pride & Prejudice as our text. So we had the program go through the entirety of Pride & Prejudice, track every word, and put together a fake Pride&Prej-sentence.

Then we tweeted out some of these fake sentences using Twitter's API, which is a fancy way of saying that Twitter used some crazy magic to make my program send out tweets. So every time I run my program, it sends out a tweet from @prideNprejubot with a newly-made fake Pride & Prejudice sentence! Basically I am a sorceress.

Anyway, if our Pride N Prejubot wasn't enough for you, feel free to check out some of our classmates' Markov tweets, such as @50mobydicks (combines Fifty Shades of Grey with Moby Dick) and @wisdom_of_biebs (combines Justin Bieber lyrics with Star Wars quotes).

Wamp Wamp Waaaaaamp  :-(       .        .      .    .   .  .  . . . ....Ta-Da!!

Yesterday around noon my confidence absolutely plummeted to the point where I was sobbing uncontrollably on the bathroom floor and thinking that this whole programming thing was all over for me and I could never tell anyone about any of it because no one could ever love me as the pathetic broken loser crybaby moron that I am. Twenty-four hours later, my confidence is really high again and I can actually talk/laugh about yesterday with my classmates, with my instructors, and on this blog (aka family/friends/the NSA). 

What the hell happened yesterday to start a cascading waterfall of tears, despair, and hopelessness? And how did I manage to get back to full confidence so quickly? Find out next time on Ava Goes To Hackbright!*

*because I'm super sleepy right now and it's way past my bedtime. Also, cliffhangers are fun. But seriously, I'm totally ok now so please don't be worried about me.


No comments:

Post a Comment