Huo Chess – Chess programming learning tutorials

Huo Chess – DV edition

Huo Chess Overview

The Huo Chess is one of the smallest open source chess programs in C# (the latest .NET console version is only 159 KB is size, even though it utilizes the latest .NET Platform; while the latest version in .NET Framework is only 44 KB in size). It has heavily commented source code so that it can be used for teaching purposes on how to develop a chess program (or a program in general). It can be easily reused in other applications, e.g. to use it as a chess engine for a robot playing chess (see here).

This program will be the basis for all the tutorials posted in this site regarding chess programming.

Feel free to re-use it as you see fit (including changing it or selling it), as long as the source is cited properly. The goal is to spread the knowledge on the basics of chess programming, so sharing is important. Feel free also to contribute to the project, by contacting us with ideas or code that can be used.

Huo Chess sites

You can download the latest files via the relative sites:

Have the Huo Chess project source code open when reading the upcoming tutorials, so that you can follow them.

Huo Chess-based tutorials

Over the years I have written several tutorials on how to develop a chess program based on the Huo Chess.

Tutorials on how to develop a chess program include:

The tutorials above are published in Harmonia Philosophica site. These tutorials will be expanded over the coming days with new more detailed ones in this site.

Keep checking for updates coming soon…

Latest Version highlights

The latest Huo Chess DV (Delta Version) editions are built in the latest Visual Studio 2022 and use the latest C# .NET 6.0 platform. Remember: along with having the goal of being the smallest chess program for educational purposes, the goal is also to constantly follow all developments in the programming landscape so as to stay relevant!

However being modern and flexible has a price. The new platform had a significant impact on the size of the Huo Chess application: Even after all optimizations, the console edition is now 159 KB (from 44 KB that it used to be) and the GUI edition is now 239 KB (from 96 KB that it used to be). Hopefully the application trimming in the new .NET platform will be improved in the future so these numbers can do down. However the .NET Framework and the Java editions remain at a 48 KB size.

Read the Develop a (chess) program in Visual Studio 2022 (C# NET 6.0) article to see how the Huo Chess program was ported into Visual Studio 2022 and .NET 6.0, along with some details on the publishing and trimming settings of the application.

Future versions candidate improvements

There is already a list of potential improvements for the next version of Huo Chess, that can be found below:

  • Add castling capability for the computer to also be able to castle. Also castling should be embedded in the CountScore function.
  • Reduce size by improving ‘peripheral’ functions (like CheckForBlackMate, ElegxosNomimotitas et cetera).
  • Increase efficiency of MiniMax algorithm, by taking into account the average score of each branch. (code already in place, but commented out)
  • Add neural network capability: This will be achieved at a very primitive level by having key points of the MiniMax algorithm (the inequalities at each node level analysis in ComputerMove) being dependent of values stored in external configuration files and by updating those files every time a game is played (increase ‘score’ if the game is a win, decrease if it resulted in defeat). This is still in preliminary stage, but I will try to have a relative Developer edition ready in the next version (without compromising the size).
  • Improve CountScore function, to take into account the position of the chessboard, whether you move the same piece twice in the opening et cetera.

Upcoming tutorials

The tutorials to come include…

  • How to start from scratch to create a new chess program.
  • How to create a chess program in Java.
  • How to develop the chess program thinking algorithm (beginners).
  • How to count the score of a chess position (beginners).

More tutorials to come soon!

Keep coming back for an updated list…

Instead of epilogue…

The ultimate goal is to go back to where I begun programming and fulfill my child dream: to create a chess program for Commodore 128. The porting of the current Huo Chess version to QBasic is currently in progress and then the road to porting to Commodore BASIC v7.0 is open…

And remember: Huo Chess was not made to be completed. But exactly the opposite: It is here to remind us all the constant struggle to perfection. A struggle so vain as any other human struggle and yet, a struggle so familiar and lovely.

Huo Chess will constantly be upgraded…

By me… By you… By everyone…

And year by year it will constantly be better and smaller…

Until there is nothing left…

Because at the end, the best chess game I will ever play will be that game I played as a child, with my father, trying to learn how to play…

2 responses to “Huo Chess – Chess programming learning tutorials”

  1. […] Huo Chess – Chess programming learning tutorials […]

    Like

  2. […] Huo Chess – Chess programming learning tutorials for details about Huo Chess and the source code of the […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: