MSDN Archive Home
Help and FAQs
C# Micro Chess (Huo Chess)
All Resource Updates
Change History (all pages)
C# Micro Chess (Huo Chess)
This code samples page is now
Find the newer versions of Huo Chess at
. See a detailed explanation of the Huo Chess algorithm at
C# Micro Chess is a free and fully open source micro chess engine. The C# Micro Chess presented in this page is a C# port of the
). Huo Chess is developed and maintained by Spiros (Spyridon) Kakos (
for the Visual Basic Edition of Huo Chess.
for the XNA Edition of Huo Chess with Graphical User Interface.
Currently C# Micro Chess (Huo Chess) is at version 0.82 at a total of
52.5 KB in size
Huo Chess plays decent chess and has managed to
, but unfortunately will probably lose if it plays with Garry Kasparov :)
Its algorithm can be used to study the underlying logic of a chess program or as a basis for your own chess program. The source code is fully available and heavily commented.
The algorithm used in this program for the implementation of the computer thinking is the "Brute Force Algorithm." Huo Chess plays with the material in mind, while its code has some hints of positional strategic playing embedded.
More analytically: When the program starts thinking
, it scans the chessboard to find where its pieces are (see
function) and then tries all possible moves it can make. It analyzes these moves up to the thinking depth I have defined (via the
path), measures the score (see
function) of the final position reached from all possible move variants and – finally – chooses the move that leads to the most promising (from a score point of view) position (
For games played by Huo Chess and for an
analytical explanation of its underlying logic
. (that page refers to the Huo Chess C++ version, however it applies to the C# version as well)
For a tutorial on how to develop a chess software application on your own see the
How to Develop a Chess Program for Dummies
. This tutorial is based on the Huo Chess and it is written by the creator of Huo Chess himself.
Huo to customize
Use Microsoft Visual Studio 2008 or Visual Studio 2010 to customize the code.
You can use the
Huo Chess Opening Book Edition
to create your personalized Opening Book for Huo Chess. You can find the Opening Book Editor at
at the MSDN Huo Chess C++ edition home page. The folder with the opening book entries must be in the same folder as the Huo Chess executable (see the Huo Chess Opening Book Editor page for more instructions).
You can also add more thinking depth capability, by adding new ComputerMove functions (like ComputerMove2, ComputerMove4 etc.), change the value of ThinkingDepth variable and make the necessary adjustments to the HumanMove function (add another if at the point where it calls the ComputerMove functions). Moreover, you can also optimize the way Huo Chess thinks by changing the CountScore function and the way the computer values the pieces or the chessboard position. For example, if you change the score of the Queen in the CountScore function from 9 to 12, then the HY will play aggressively to attack the opponent's queen and at the same time try harder to defend its own queen. You can also — for example — give a high scoring to the existence of an opening column with a rook controlling it, so as to make the computer play more with its rooks and try to take over columns with them. Any FEEDBACK is WELCOME with better configurations of the Opening Book or the CountScore function!
The program requires .NET Framework 2.0 or higher to operate.
Sep 28 2011 at 4:42 PM
, version 22
Feb 1 2009 at 11:41 AM
GAMES OF HUO CHESS
Place: Athens, Greece
White: Microchess (as provided by BenLo Park)
Black: HuoChess v0.82 (with Opening Book)
Result: Draw by threefold repetition
1. e4 e6
2. Qh5 Qe7
3. Bc4 Kd8
4. d4 a6
5. Bf4 d5
6. exd5 f5
7. dxe6 Bxe6
8. Bxe6 g6
9. Qe2 Nd7
10. Bxc7+ Kxc7
11. Qc4+ Nc5
12. dxc5 Qg7
13. Qf4+ Kc6
14. Qf3+ Kxc5
15. Qd5+ Kb6
16. Qb3+ Kc7
17. Qc4+ Kd6
18. Qd5+ Kc7
19. Qc4+ Kd6
20. Qd5+ Kc7
21. Qc4+ Kd6
22. Qd5+ draw by threefold repetition
Huo Chess played a good game. It did not give up pieces without reason and did not lose chances to kill opponent’s pieces when possible.
Nov 27 2011 at 5:20 PM
Sign in to add a comment
CS Micro Chess v0.82
Fri Jan 30 2009 at 8:00 AM
More Tags ...
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.