Let me repeat that, algorithms aren’t scary.
There’s this whole negative idea going around the media that algorithms are running our lives: how we work, how we relax, how we interact with our surroundings, and even how we date and form interpersonal relationships. They’re correct about how deeply technology influences our society but where they’re wrong is when it’s portrayed as a harmful, parasitic infestation in our society. Let me tell you why.
According to Wikipedia, “an algorithm is an unambiguous specification of how to solve a class of problem.” In my own words, algorithms are just set processes that we use for any range of things. That’s all that means. No magic, no wizardry. We’ve all been using “algorithms” to go about our daily lives. Breathe in, breathe out. Repeat. That’s a set process that your body follows even when you aren’t thinking about it. It solves a few “problems” that your body has, such as the constant need for oxygen. Think about driving to the store. You know to start the car and then you get into a sort of loop of instructions. Look ahead, check for obstacles, manage the speed of the vehicle, and turn the steering wheel to make sure you’re going in the right direction. Occasionally you need to decrease speed because of one of those arbitrary red octagons or a shining light in the sky, but once you come to a complete stop or see a green orb in place of a red one, you can go back to the same routine.
Wikipedia goes on to say, “Algorithms can perform calculation, data processing, and automated reasoning tasks.” Another good example of an algorithm that everyone knows is long division. (Sorry to all of the people whose 5th grade selves I just triggered.) Seriously though, think about long division. Scrape the bottom of those empty barrels and pull that process out to main memory. You take a number and then you break it up into chunks. You apply a simpler operation to the small chunk, carry some numbers, and then repeat. Then once you’ve done this for all the chunks, you put the results together and you might also be left with a remainder. That’s what we call a “divide and conquer” algorithm in formal computing.
Alright, I’m done with that. The horror is over and you can stop going back to the dark times of middle school math. Let’s talk about a game that everyone loves: Pac-Man.
Pac-Man, in case anyone is not familiar, is a game where you play as a small yellow orb that waks around a map trying to eat all of the little white pellets before any of the four ghosts (named Blinky, Pinky, Inky, and Clyde) catch and kill you. It’s pretty barbaric when you think about it, but at least every once in awhile a small pixelated fruit drops into the lower middle of the level to give you bonus points on consumption. There are a ton of algorithms going on in a typical game of Pac-Man, but the most interesting ones are the behaviors of the four ghosts. To increase replayability and to stop the game from getting too boring, the creator of the game, Toru Iwatani, stated that the four ghosts behave as follows:
- The red ghost chases Pac-Man, always moving directly towards him.
- The pink ghost aims for a position slightly in front of Pac-Man using a basic predictive algorithm for where it thinks you’re trying to go.
- The blue ghost is described as fickle, sometimes heading towards and sometimes away from Pac-Man.
- The orange ghost behaves randomly, throwing a wrench into hyper-optimizers’ plans.
So yes, algorithms are everywhere around us, but they have been for years and they will be for a very, very long time.
Algorithms are not inherently bad, and they have a lot of positive effects on our life. Search engines bring troves of information to us at a whim. Maps and other GIS (Geographic Information Systems) programs allow us to get from point A to point B without having to deal with one of those pesky paper maps. Social media, for all of the negatives that go along with it, make it possible to stay in contact over vast distances and large swaths of time where it wasn’t possible or practical to before. All of these are only possible because some really smart engineers somewhere thought of some crazy algorithms that take really hard problems and make them possible to implement on a planetary, sometimes even interplanetary, scale.
Think about this kind of stuff next time you see an article or hear a news clip where people are talking about how algorithms are evil or that mad data scientists are trying to control our thoughts. Some of the time they’re trying to make the world a smarter place. Most of the time, they’re just trying to sell you something. Rarely are they outright malicious. Algorithms are just set processes that take data in, do computations, and spit more data out. Also, remember that computers are just rocks that we tricked into thinking.
This is the first of a few articles I’m going to do about algorithms. The next few will be on different classifications of algorithms, examples of them, and how they’re applied around us every day.