Category Archives: Starting Out

Fun Ways to Sharpen Your CS Skills

If you’re anything like me, once you learned how to code, you would take any chance you could get to write little programs for fun. I remember once I finally “got” BASIC on my Commodore 64 growing up, I would spend hours writing the cheeziest (looking back) programs. A favorite of mine was writing countless “Question and Answer” programs, where the computer would ask “How are you?” and depending on your answer, the program would issue a different (and probably inappropriate given my age at the time) response.

Time Marches On

As time went on though, and I got better at programming, learned the fundamentals, studied Computer Science – things started to change. I still loved to program, but my goals became larger and more complex. Pet projects would take days to complete, then weeks, then months. Once I started doing it professionally, that added a whole new level, where the projects were for money, and project management, sustainability, fiscal viability, etc, all became factors. I had to specialize and focus on specific areas to remain competitive. And the technology changed – whereas once I was communicating directly with the processor and memory I/O, now I was communicating 17 levels up to a a COM object or framework API. It was just a different ballgame – which isn’t necessarily a bad thing, but sometimes working at such a high level for different purposes can make you lose site of the underlying CS. Sometimes it’s important to keep your CS skills as fresh and sharp as your software engineering ones.

Some Fun Ways to Up Your CS Game

Luckily, there are some sites out there that are awesome for keeping those little grey CS cells active in your head.

Project Euler
This is by far my favorite one. Euler offers a large number of problems (currently 300) that require a computer program to solve. They are generally geared toward mathematics of different levels and areas (generally the higher the problem, the more difficult it is), and you can solve them using any method or programming language you wish. The website keeps track of how many you’ve solved and how you’re faring with the rest of the members, but really you’re competing with yourself to write the best program you can. As you get into later problems, even your efficiency matters, as your first solution might take 3 days to complete, whereas the better one takes .25 seconds. They have discussion forums for each problem as well (once you’ve solved it), where people show their solutions and help each other out. Some example problems on the site:

1. Add all the natural numbers below one thousand that are multiples of 3 or 5.
7. Find the 10001st prime.
15. Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner?
109. How many distinct ways can a player checkout in the game of darts with a score of less than 100?
157. Solving the diophantine equation 1/a+1/b= p/10n

As you can see, there are a large range of problems targeting different areas and algorithms. I’ve solved 34 to date – sometimes I’ll spend a lunch hour working on a problem, they’re great fun and you can do them at your own pace – and learn new techniques in the process.

Hack This Site!
No, that wasn’t an invitation! Hack This Site . Org is an interesting site that offers a number of security, reverse engineering, and application development missions. While I’m actually against the practice of unauthorized computer access (especially being a IT Manager by day) – penetration testing is a great thing for a network administrator to know, and reverse engineering is a fantastic thing for a programmer to know. In the high-level development world we now live in, getting back to the processor and memory level is definitely a plus – and studying the binary structure of an executable certainly achieves that. Not only does it strengthen your machine language skills, but it also gives you great insight into how compilers work, how operating systems link DLLs, management memory, and achieve IPC.

Many More

Project Euler and Hack This Site are the two I focus on (and between the two of them, there are enough problems to keep me busy for years), but if they aren’t your cup of tea, here are a list of other programming problem related sites:

Bright Shadows
Electrica
Programming Challenges
Python Challenge
TopCoder

Have fun, and get your CS in shape!

From Pong to Platformers – An Introduction to Game Physics – Part 4

Acceleration for Better Goomba Stomping

So now we understand positioning an object on a screen, moving the object around using the principles of velocity, and how to handle collisions with walls and other simple objects. While we can do quite a lot with these simple fundamentals, there is one more that is key to modeling realistic movement. We can understand a little how it works by watching how Mario jumps in the Super Mario Bros series.

Physics - Mario
Mario jumps in an arc movement

For those who haven’t played Super Mario Bros, Mario jumps in an arc. When he begins to jump, the sprite on the screen moves up very quickly, then slows at the top of the arc, then slowly starts moving back down, until he’s going the same speed as when he started the jump when hitting the ground. The reason for this movement is due to acceleration. Specifically, the game is modeling the affects of gravity, gravity being a force that causes acceleration in the downward direction.

Just as velocity is the rate of change of an object’s position (e.g. meters per second), acceleration is the rate of change of an object’s velocity (e.g. meters per second per second). Gravity is a force that causes constant acceleration in the downward direction. Because of this, though Mario starts with a velocity that causes him to move in an upward direction, acceleration downward causes this velocity to slowly decrease, then reverse, getting faster in the opposite direction.

Programatically, we can handle this the same way we do velocity. In addition to updating position with velocity, we’ll want to update velocity with acceleration – so we’ll need two more variables, AccX and AccY. During our redraw, we’ll want to update both velocity and position: (VelX = VelX + AccX) (VelY = VelY + AccY) (X = X + VelX) (Y = Y + VelY). Acceleration can be used to model many realistic scenarios besides jumping in platform adventures, such engines firing in a spaceship simulator, or shells being fired from a cannon in a tank war game.

Onto More Advanced Topics

We’ve covered position, velocity, acceleration, and basic collisions – with these basic techniques, a wide range of realistic motions can be accomplished when making your next game. There are, however, hundreds of more topics, including friction, complex collisions, fluid dynamics, light oriented (shading, diffraction, reflection), etc. However, before getting too crazy, try some of these techniques in simple games to get familiar with Newtonian Mechanics. After that, more advanced topics will be easier to handle. Have fun with you physics!

From Pong to Platformers – An Introduction to Game Physics – Part 3

Thinking Inside the Box

However, now that we have movement, we run into an issue. When we think of a classic video game, we think of boundaries, such as the edge of the screen, or floors/walls/ceilings, or other objects. In many games, such as platformers, these boundaries will stop the object from moving. In games such as Pong and Breakout/Arkanoid, the boundaries cause the object to bounce.

Physics - Breakout
In the classic game Breakout, the ball bounces off the walls, paddle, and bricks.

The idea of bouncing is the boundary only reverses one dimension of the ball’s direction, while the other dimensions remain unaffected. This is expected behavior that reflects real life, as remember that vectors are treated independently in each dimension. E.g. if the ball is traveling right and up, and hits the right wall, it should continue to travel up, but it should start traveling left. The right wall only affects the left-right dimension, it never affects the up-down direction. If the ball then hits the ceiling traveling left and up, the ceiling will only affect the up-down direction, and now the ball starts traveling left and down.

Physics - Bounce
Each wall only affects the direction in one dimension.

Looking back, our program currently has 4 variables. X (x position), Y (y position), VelX (x velocity), and VelY (y velocity). When redrawing our screen, in the case of boundaries, we would check to see if the ball has “hit” any boundaries – that is, if the coordinates of the ball (X and Y) reside in the same space as the coordinates of any of the boundaries. If so, we adjust the velocity accordingly. E.g. if the ball has an x velocity of 4 (traveling 4 pixels per redraw to the right) and a y velocity of -2 (traveling 2 pixels per redraw downwards), and hits the right wall, the x velocity will be reversed – that is, multiplied by -1 (VelX = VelX * -1). So now the x velocity is -4 (traveling 4 pixels per redraw to the left), and we’ve achieved our bounce. If we apply this boundary check to a movable paddle, we now have pong. If we apply this boundary check to bricks at the top of the screen, we now have breakout as well!

Onto Part 4

From Pong to Platformers – An Introduction to Game Physics – Part 2

Velocity

Velocity is a fancy word for speed with a particular direction. Going 88 MPH would be speed. Going north at 88MPH would be velocity. But forgetting the direction component for a moment, speed is measured in distanced traveled over time. For example, when we say 88 Miles per Hour, we’re saying the object is moving a distance of 88 miles over a period of an hour – i.e. the object is changing its position by that much in an hour.

Remember, our video game object has position too – it has its coordinates. If we introduce velocity into our game, we now give our object the ability to move by the laws of physics. If we redraw our object once a second, and the object is going 5 pixels right per second, we would be adding 5 to our X coordinate (the value stored in our X variable) every second, then redrawing the object. If we want it to move faster, we increase the speed, 6 pixels per second, 7 pixels per second.

Don’t Forget the Vector!

Vector is another mathematical term for a quantity with a direction involved. Remember, velocity is speed with a direction, so it is a vector. There is a helpful property of vectors that allows us to split them up by dimensions – that is, if something is moving in two dimensions at once (north and west, up and north, south and east and down), we can handle each direction separately. If something is moving north and west, we can talk about how much it’s moving in the north direction and how much it’s moving in the east directly independently. In our video game case, we can say “okay, the pong ball is traveling -3 pixels per second in the X direction, and 2 pixels per second in the Y direction). That means every second we’re going to subtract 3 from our X variable, and add 2 to our Y variable, then redraw the ball. The movement of the ball would appear to be going diagonally up and left, as seen here:

Physics - Velocity
We handled each dimension separately, but the end result was the diagonal movement.

Now we can store our X velocity and Y velocity into variables too (for example, velX and velY). So, every time we redraw the screen, we are going to add velX to X (x = x + velX), and velY to Y (y = y + velY). So if we have a very large velX, the ball will be moved across the screen very fast from left to right. If we have a very large negative velY, the ball will be moved down the screen very fast. And we don’t need to press the key each time, our velocity will do the work for us through simple addition (or subtraction if we are adding a negative number).

If we wanted to design a fun experiment, we could assign our arrow keys to change velocity. Pressing left would subtract one from velocity in the X direction, pressing up would add one to velocity in the y direction, etc. This would have the effect of making the ball move in a direction more quickly the more you press the arrow in the same direction, or slow down and start moving backwards if you press the arrow in the opposite direction. Not pressing the arrows would simply keep the ball doing whatever it was doing – e.g. traveling in whatever direction it was before.

Onto Part 3

From Pong to Platformers – An Introduction to Game Physics – Part 1

Before we get started, I feel the need to point out that this entry will in no way even begin to approach the territory of being comprehensive in the study of video game physics. This is targeted toward those who have little background in physics and is very much a starter tutorial. In general, the better and more realistic the game physics, the closer you’re getting to actual physics – and that’s a lifetime study in itself. However, there are some basic tips and tricks to know when dealing with intro action and arcade style games.

Newton and his Mechanics

While games have gone from simple squares on the screen to 2D sprites to 3D-super-rendered-polygon-ray-traced-blammo-wow objects, the actual science behind their movement on the screen has stayed relatively the same – mainly because their movement is based on the movement we’re used to, what we see all around us every day. We reproduce it in our video games (for the most part) because it’s natural and makes sense to us. We’re mirroring physics! Specifically Classical (or Newtonian) Mechanics. We generally don’t need to take into account relativity or quantum mechanics when making Mario jump from one green pipe to another.

So to understand how the pod in Lunar Lander works, we need to understand how a real lunar lander would work. But let’s start out more simply.

Mass and Position

What is mass? This is a large, fundamental question that involves inertia, resistance to movement, the amount of force necessary to move the object, etc. But we don’t need to get that deep into it. Mass is physical stuff. You have mass, a ball has mass, the planet has mass, your dog has mass, Catholic churches have Mass, etc. (ba-dum-dum). Anything physical has mass. It doesn’t start moving for the most part, it stays where it is until something pushes it (in the case of a person, your muscles). If it’s already moving, it doesn’t stop moving unless something stops it (a wall, friction, a large rope, etc). It basically keeps doing whatever it’s already doing.

Reproducing an object that sits there and does nothing is very easy to do in a video game. Simply create a representation of an object, whether it be a colored square (Pong), a bitmap graphic (Mario), or a polygon object (Lara Croft) and put it on the screen. The actual way to do this is outside this tutorial (Check out Creating a Blackberry Game if you’d like to see how to do it in Java). Just as in the real world an object has a position, in the video game world, the object will have a position too – a coordinate on the screen. In the below example, we use a simple object that is 1 pixel in size for a pong-like game.

Physics - Object Location
The green pixel is our pong ball

When programming this, we would need to store the dot’s X coordinate and Y coordinate into variables, in this case, store a 6 in X, and a 2 in Y. If we wanted to use the arrow keys to move this object, we would simply add or subtract from the coordinates as the appropriate key is pressed (e.g. pressing up -> Add 1 to Y, pressing down -> Subtract 1 from Y, pressing right -> Add 1 to X, pressing left -> Subtract 1 from X). Then redraw the object in its new location. Our drawing routine would always just take the values and of the X and Y variables and draw a pixel at those coordinates on the screen.

While this would be enjoyable for 2-3 seconds, it would overall be a fairly boring game. We would be doing physics’ job in this case, telling the object how to move every step of the way. We want physics to carry its load. So let’s program in another property.

Onto Part 2

An Introduction to Recursion

I remember the first time I formally encountered recursion – it was sophomore year of high school and I was watching as my CS teacher, Mr. Kendall Chun, was explaining how instead of using loops, a function could repeatedly perform an action by calling itself. The concept at the time just completely blew me away. It seemed to me, like I think it does to a number of people when they first learn about it, almost magic. I used it on more of a faith basis until I became more comfortable with it – and now, like any programmer, it is a standard part of my arsenal.

What is Recursion?

While recursion is a powerful technique, there is definitely nothing mystic about it. Simply put, recursion is when a function uses itself in it’s own definition. It can be a little easier to demonstrate by showing an example.

Non-Recursive Function

First off, remember that a function is a dependence between two values – or in plain terms, it’s a “machine” where input goes into it, and output comes out. Usually that output is generated by doing something to the input.

Take f(x) = x+3. This is a simple function that says whatever I put in, I get that plus 3 out – so if I put 7 in, I get a 10 out. f(7) = 7+3 = 10. No biggie, the function is defined in terms of x – we put a 7 in for x, we got a 10 out – no recursion yet.

Recursive Function

The most classic example of a recursive function is the factorial function. For those unfamiliar, the factorial function multiplies all integers less than or equal to itself, and is represented by an exclamation mark. So 5!, or 5 factorial, is equal to 5 * 4 * 3 * 2 * 1, or 120.

Why is this recursive? Check it out:

  • 5! = 5 * 4 * 3 * 2 * 1
  • 4! = 4 * 3 * 2 * 1
  • 3! = 3 * 2 * 1
  • 2! = 2 * 1
  • 1! = 1

So I’ve listed the factorials of each of these numbers out, so what? Well, if 4! = 4 * 3 * 2 * 1, then we could say:

  • 5! = 5 * 4!
  • 4! = 4 * 3!
  • 3! = 3 * 2!
  • 2! = 2 * 1!

As can be seen, any factorial is the number going into it times the factorial of one less that number. This means that factorial uses itself as its definition -

f(x) = x * f(x-1)

Factorial is the number going into it (variable x) times the factorial of the number minus 1. So factorial of 5, or f(5), is 5 * f(4). What’s f(4)? 4 * f(3). f(3) = 3 * f(2), and f(2) = 2 * f(1).

The Base Case

The issue is that for recursion to be useful, it has to STOP somewhere. In the factorial example, nothing stops it. We would say f(1) = 1 * f(0), f(0) = 0 * f(-1), f(-1) = -1 * f(-2), ad infinitum. Endless loops are no fun (unless the basis of annoying pranks), so we need a way of saying STOP! This is where the “Base Case” comes in. It is simply a point during execution, or in the definition of the function, that says “no more calling yourself, stop the looping madness”.

In the case of factorial, it’s f(0). f(0) = 1. Period. It doesn’t involve itself any longer, it just returns 1 – it’s a static value, an axiom, a solid rock, where the buck stops. Every recursive function needs a base case.

Full Execution

So the full definition of our factorial function is

f(0) = 1
f(x) = x * f(x – 1)

That means, if we call f with 0, we get 1, otherwise we perform the second operation. Let’s try it out with 4. We should get 4 * 3 * 2 * 1 = 24.

  • f(4) = 4 * f(3)
  • f(3) = 3 * f(2)
  • f(2) = 2 * f(1)
  • f(1) = 1 * f(0)
  • f(0) = 1

Now we know what each function returns, we can fill in the unknown values

  • f(1) = 1 * f(0) = 1 * 1 = 1
  • f(2) = 2 * f(1) = 2 * 1 = 2
  • f(3) = 3 * f(2) = 3 * 2 = 6
  • f(4) = 4 * f(3) = 4 * 6 = 24

It worked! And is very easy to implement in whatever programming language you happen to be using. Once you become comfortable using recursion, you’ll find it’s useful all over the place, because the world around us uses recursion constantly – it is a large part of math and our Universe.

Other Fun Examples

Looking for some more examples of recursion?

  • The Fibonacci Numbers – 0, 1, 1, 2, 3, 5, 8, 13, 21, etc. Each number is defined by adding the two numbers before it – so f(x) = f(x-1) + f(x-2). Double recursion – it makes use of itself twice! Our base cases are f(0) = 0 and f(1) = 1.
  • Any Geometric Series – The powers of 2 for example – 1, 2, 4, 8, 16, 32, 64, 128, 256. Each number is the previous number times 2. We could define this using exponents, but let’s do it with recursion! f(x) = 2 * f(x-1). Base case f(0) = 1.

Recursion rocks, so try finding some situations where loops are used that you could use recursion instead – it’s a lot more fun!

What Language to Choose, What Compiler to Use?

Whether you’re completely new to programming, or have been out of the game for so long that you’re completely lost, an important first step in becoming a coder is choosing your first language. While it is true that learning the principles behind Computer Science is what is truly important, in practice one needs a way of implementing these important concepts, converting theoretical into reality, and a trusted language is necessary for this. There are thousands of programming languages at the disposal of the modern day programmer, and making a choice of which one to use can be a little daunting. Coupled with this, there is no one language that fits all situations, each language has its own strengths and weaknesses in different areas.

What Platform Will You be Programming For?

The first question to ask is what system are you creating software for? This isn’t simply a question of Windows vs OS X vs Linux. You could be programming console systems like your Playstation 3 or Dreamcast. You could be interested in creating applications for your smart phone, such as a Blackberry or Treo. Or perhaps you want to write a small program to run a microcontroller in a robot you’ve built.

If you are indeed completely new to programming, you may want to start by writing programs for your computer. Programming for unique architectures can often have their own slew of hiccups and peculiarities that will detract from learning core ideas. The goal is to become comfortable with the idea of programming in general, get the general concepts under your belt, then move on to the more advanced stuff as you feel more confident.

Okay, So What Language Do I Choose?

Even after making the decision of starting with your PC as a platform, the choices aren’t over yet. Most languages can be used to create programs on your desktop. The ones we tend to hear a lot about are BASIC/Visual Basic, C/C++/C#, and Java. Once you have chosen a language, you need a program called a “compiler” which converts your code into machine code the computer can understand. Below I’ve posted links to a few popular choices.

BASIC / Visual Basic

BASIC has typically been used as a beginner’s language. It’s easy to learn and quick to implement. However, the same simplicity that makes it a great language to start with also limits its potential as projects get bigger and more complex. In comes Visual Basic (especially modern day VB.NET). It combines the simplicity of BASIC’s syntax with the power of .NET and object oriented programming. While you may not be familiar with these concepts, VB.NET paves the way of making life easy until you’re ready to tackle these advanced topics.

For those looking to start with BASIC, especially one geared toward game development, Dark BASIC (http://darkbasic.thegamecreators.com/) is an excellent choice. Though it is not free, there is a trial version, and the full version is only $39.99 (at the time of this article).

If you’re looking to go with Visual Basic, which is this author’s suggestion, Microsoft currently offers Express editions of all its products, completely for free. The entire product family is incredibly powerful and a very good deal (free!). Check out Visual Basic Express 2008 (http://www.microsoft.com/express/vb).

C / C++ / C#

The C family of languages are definitely less fluffy than Visual Basic. However, this fits their purpose – less of beginner languages, and more powerful as projects get larger and more involved. This is not to say it is impossible or even a bad idea to learn programming using C – there are many concepts central to Computer Science and computer architecture in general that can be demonstrated much more clearly with C than with VB, such as memory management.

C/C++ have been around for a while and are the preferred languages in many different environments – because of which a large number of tools can be found. Again, Microsoft offers Visual Studio Express versions of their C++ compiler. The far most well known compiler, however, is the GNU compiler, which can be found on countless platforms, including UNIX, Linux, OS X, etc. For more information, check it out here (http://gcc.gnu.org/)

C# is a creation of Microsoft and tied much more closely to the .NET framework. While it may be not the perfect choice for a beginner language, it is a great language for both web application work as well as creating applications for Pocket PCs and Windows Mobile powered smart phones. Visual Studio Express also contains a C# module.

Java

Java is another interesting choice – it looks similar to C++ at first glance, but offers something quite different. Java is geared toward true cross platform portability. When you write and compile Java code, it is turned into what’s called “Byte Code” which actually runs on a virtual machine on top of your real machine. What’s neat is that while the real machine underneath can be different, each machine will run the same virtual machine, so the code you write for one platform will theoretically work for another. Java, for this reason, is an excellent choice for client side web applications and mobile applications on cell phones. When I write applications for my Blackberry, I always use Java. Sun offers its official (and free) Java compiler as a part of the Java SDK (JDK) – you can find it here (http://java.sun.com/javase/downloads/index.jsp).

You’re On Your Way

The language you begin with is important – it is your first companion as you explore the sights and wonders that are Computer Science. Don’t be too worried about picking the perfect language though – if you’re fairly comfortable with your choice you’ll be fine, and once you’ve built up some programming skills, you can easily branch out and try new languages, especially ones that might suit your needs in the particular project you’re working on. Good luck!

Play Adventure Games, Be a Better Programmer

> Open trapdoor
> Go down
> Turn on lantern

I can’t count the number of times I typed the sentences above on my faithful Commodore 64 immediately after getting home from school every weekday afternoon. An explanation to the uninitiated: these simple statements were a way of communicating with a style of game known as “interactive fiction”, or “text adventure”. The particular one that started it all for me was the classic masterpiece known as Zork, where every day I could explore a mysterious underground empire from my room. While the magic of text adventures is an article in itself, after playing Zork once I was completely hooked. Not only did I seek out more adventures to sink my teeth into, I was also lucky enough that my parents purchased a PC for me soon after. From there I discovered the wonder of graphical adventure games, like the Monkey Island series from Lucas Arts and the Kings Quest series from Sierra. From then, and even to this day, I was a complete adventure game junky. No other genre of game could come close to giving me as much enjoyment.

How are adventure games relevant though?

For those who haven’t played an adventure game before, the premise is generally one of accomplishing goals through a series of small tasks. For example, in the popular classic from Lucas Arts, “The Secret of Monkey Island” (spoilers ahead!), at one point in the game it’s necessary to obtain money to purchase a number of items. There isn’t, of course, a pile of money sitting on the ground – that would be too easy. You need to earn it, in this case, from getting paid to get yourself shot out of a cannon at the circus. However, they won’t stick you in the cannon unless you’re wearing a helmet. Guess what? You need to find a helmet, and there is no helmet in the game. There is, however, a cooking pot in the tavern’s kitchen that would fit perfectly on your head. However, you can’t get into the kitchen because the cook won’t let you in…

As you can see, there is a goal (obtain sum of money), and a number of tasks involved in getting there (get into kitchen, get pot, wear it, fire out of cannon). Before you can accomplish a task, there are a number of prerequisite tasks that must be completed first. Each of those tasks has its own set of tasks to complete first, etc. In Computer Science, we call this step-by-step procedure an algorithm.

Algorithms are the heart of programming

Computers, the powerful machines they are, are at their core relatively dumb. They need to be given a list of instructions to follow. They can perform about 4 billion of them a second, but at the end of the day they still need that list of procedures, outlined step-by-step. This is where you, the programmer comes in. Given a goal you wish to accomplish, you must devise a series of steps to lead to that goal, then translate these steps into a language the computer (ultimately) recognizes, such as Visual Basic, C++, or Java.

The same mentality that guides us to get the helmet, to get the cannon, to get the money, is the same process that guides us to be good programmers: to think in steps. A top down approach of taking an overall goal, breaking it into smaller pieces, further dividing each of those pieces into easy steps, until we’ve turned a very large and complex problem into a series of tiny, easy to handle tasks. And sometimes in programming we need to take alternate avenues – just as there is no helmet in Money Island but a cooking pot which makes an excellent substitute, there will be many times in programming where alternative over conventional thinking is necessary to accomplish a goal.

Why adventure games build these skills effectively

The one issue with programming, especially if you’re new to it as I imagine many people reading this article are, is it is a fairly foreign concept. You’re so busy struggling with the syntax of the new language you’re learning that the overall design of the program itself suffers. While this is a necessary part of learning to program, wouldn’t it be great if there were other exercises you could do in the meantime to strengthen your algorithm building skills?

Enter adventure games. They are a great tool to improve your “algorithmic dexterity” as they are enjoyable and usually take place in recognizable situations that you are accustomed to. We all know what a cooking pot is, and we all know we can put it on our head. We know if we turn a lantern on, it’s going to provide light. These are situations we’re used to seeing. However, these common situations put to the extreme focus of step-by-step procedures are what build our instruction-making skills – and adventure games are the absolute masters of requiring this brand of thinking for hours at a time.

So start playing games!

I don’t want to give the wrong impression – learning to program is a lot of hard (but enjoyable!) work, and there are some dry moments when it takes memorization and reading a book/screen. However, when dealing with the flowcharts academia will make you draw out when learning algorithms (a favorite seems to be “Draw out your morning routine!”), or if you’re learning on your own, try supplementing the boring with a little fun. Fire up an adventure game and train your algorithmic brain! Not only will you build a necessary skill, but you’ll also have fun doing it.