theparticleman / DonkeyKongAscii

3 stars 0 forks source link

Donkey Kong ASCII

A long time ago in a galaxy far, far away... I taught an introduction to object oriented programming college class. Since it was an introductory class most of the code we wrote was pretty basic, including a lot of console, non-GUI, non-web apps. I wanted to demonstrate to my students that even with fairly simple code and limited user interfaces it is still possible to write code that does interesting things. So as an example (which eventually got turned into a coding exam) I created a simplified ASCII version of Donkey Kong.

The goal of this activity is to attempt to modify the Donkey Kong ASCII code that was originally written in 2007.

Level 0

The first step is to get the code copied to your local machine, get it compiling, and make sure that the code still works.

To copy the code to your local machine you can git clone the repository. Or if you don't have git installed (or prefer it for some other reason), Github allows you to download all the code as a zip file that you can then extract on your local machine. Use whichever method you prefer to get the code on your local machine.

The next part of level 0 is to get the code compiling. The code was originally written in Visual Studio 2005, targeting .NET Framework 2.0, both of which are Windows only. That is problematic in our modern, multi-platform world. Some initial work has been done to make the code work with .NET 5 (which is cross platform), but more work probably remains. To get started, download and install .NET 5. If you would like to use an earlier .NET Core version, you can probably modify the code to support that.

The final part of level 0 is to actually run the code. In a terminal, change to the directory where you put your local copy of the code (specifically the directory where the DonkeyKong.csproj file is located). In that directory running dotnet run should start the app.

Depending on your terminal and which font it uses, it's possible that some of the special characters used may not display correctly. If the player or Donkey Kong don't show up, try changing which characters are used when displaying them. The code to do that is in Display.cs on lines 64 and 75. This has been reported as a problem on MacOS.

Level 1

Now that you've finished level 0, we'll start getting more familiar with the code. This and the remaining levels are much less prescriptive than level 0. Each level has a list of suggested activities to accomplish before moving to the next level. If you want to complete all suggested activities before moving to the next level, that's great. But if you want to move faster that's okay too. If there are other activities that are not in the list of suggested activities that you want to do before moving to the next level, feel free to do so.

The goal of this level is to get more familiar with the application and code, as well as start making the code a little easier to work in. Here are some possible level 1 activities:

Level 2

Now that you're more familiar with the code the time has come to start making it your own and preparing for more significant changes.

Here are some possible level 2 activities:

Level 3

At this point you should feel fairly comfortable navigating and modifying the code. It's time to start adding new features.

Here are some possible level 3 activities:

Level 4

At this point you should be familiar with the code and comfortable adding features. Now it's time to go crazy with much more significant changes to the code.

Here are some possible level 4 activities: