Is it easy to learn C#? Sure, as a beginner you can quickly learn to write a few small console programs. But what’s the next step? You need something more difficult, but it shouldn’t be too difficult either. This is the beginning of a series that uses a graphical game to show how to program C#.

In the following series of articles I explain how to program the computer game HexaFour. This game is a bit more complicated, so I can use it to explain step by step how to program with C# and some other things that are important in software development. This will not be an app to publish yet, that would be too difficult to start. But this game is a good start to explain tools and concepts that are also important for the development of larger programs.

Game idea

First of all, I only have a rough idea for the game I want to program: Two people should be able to play it. Players can take turns dropping hexagonal tokens from the top into a game board. A token drops down until it hits an anchor position. There are two possibilities:

Two pictures a and b show the possibilities described in the text.

If the anchor position is free (case a), the token remains on the anchor position. If the anchor position is occupied by another token (case b), the other token moves on and the token coming from above takes the anchor position.

The winner is the player who first has four of her tokens in a horizontal or diagonal line. In this example, blue has won on the next move:

A game board with red and blue hexagons. The movement of the hexagons is indicated with arrows. After the movement is completed, four blue hexagons will be in a diagonal row.

The sequence of the next move of blue is marked with blue arrows. The new token thrown in will move the blue token below it. This token will move down one position diagonally and then form a row of four with three other tokens. Thus blue has won.

I already have a name for the game: HexaFour. “Hexa” because the tiles are hexagons and “Four” because you need four in a row to win.

Besides the name and the rough idea of the game, many things are still unclear. But it is not worth to make a concept for everything and only then to start programming. You can make much better progress (and have more fun) if you implement the first things quickly, then try them out and think about how best to proceed from there. In real software projects, this is often done in the same way; it’s called agile software development.


I use the programming language C# here. C# is perhaps a little bit more difficult for beginners than python, for example. However, when the programs get bigger, I think C# is an optimal way to go. There are many commercial programs that are developed with C#.

For real games, you actually need a gaming engine - you could use Unity, for example. But then, as a beginner, you have to learn a lot of things at the same time: the C# programming language, tools for that programming language, the gaming engine, tools for the gaming engine, and so on. That’s a lot for the beginning. Therefore I start here without a gaming engine and use the graphics library Woopec instead. I’m not completely impartial there, because I developed Woopec myself :-)

The game in this course won’t look as cool as a Unity game, but for that you can get started here with very little prerequisites. You’ll first learn how to develop software with C# and then you can move on to Unity for the next game. C# is also used as the programming language in Unity, so you’ll learn a lot here that you’ll also need later in Unity.

For software development, you need to know more than just a programming language and tools. When a program gets bigger, other things become more important. The first version of a program is quickly assembled. You nail a few boards together and you have a house with a roof where you can sit dry. But then the house needs more rooms and additional floors. Then the house is to be expanded into a small city. You need more houses, then streets, then bigger streets, a hospital, a theater, an airport, … At some point you reach a point where this can get very complicated. At a certain size you lose the overview if the whole thing is not well organized and structured. That’s why, as we develop our program here, I’m also going to pay more and more attention to making sure that the program is well organized and structured. In his book “Clean Code. A Handbook of Agile Software Craftsmanship” Robert C. Martin calls this clean code:

[…] writing clean code ist a lot like painting a picture […] a programmer who writes clean code is an artist who can take a blank screen through a series of transformations until it is an elegantly coded system.

Let’s see how well we will succeed in writing clean code here.

There is one point I must make at the end: While I will explain many things here, the following blog posts are most definitely not a complete introduction to C#, programming practices, or clean code. Many others have already done that much better than I ever can do. I only explain a few necessary or interesting things here and give you links to more detailed information. Based on this, you can search for the websites, videos or books that best fit your needs.

Overview of the posts in this series

The following list contains the posts of this series published so far.

Chronological overview:

If you are looking for specific topics, these lists can help you:


Visual Studio:

Woopec graphics library:

Clean Code:

HexaFour game:

Comment on this post ❤️

I am very interested in what readers think of this post and what ideas or questions they have. The easiest way to do this is to respond to my anonymous survey.

Previous Post
Developing Software is just as easy as Building Airplanes (h4-00)
Next Post
How to easily write your first C# program with graphics (h4-02)