Posted on November 15th, 2012 by Richard
Chess programming is a hobby I enjoy.
I have done several code snippets in several programming languages for help with computer chess play.
I do have an ambition one day to have programmed my own chess engine.
So far I have done a java chess engine but that was with the help of ThinkQuest and used sections of premade code. My very first introduction to chess programming was writing Perl scripts to clean and parse pgn files using regexes. I learnt a little bit of Perl programming and of course it is a great language for text & data wrangling & so quite suitable for chess.
I even made a perl script that takes a pgn file and outputs music! Quite amazing what is possible to do in programming.
This week I made the start of a console chess game in C. Getting a good board representation (and with a GUI if you want good graphics) is a basic first stage in chess programming. GUI=Graphical User Interface and is a nice frame to hold the chess game and display nice images like a real chessboard in as opposed to a basic text output at the console (command shell).See screenshot below:
The next obstacle is to get the moves input and output & I struggled with this. It is a good, but for me, a hard learning curve and this was only for a basic console output without AI (AI=Artificial Intelligence)! Topics covered include array handling and string manipulation. Screenshot of part of the code in code editor below:
I started then to look at wrapping this all in a Windows GUI with a Win32 project in Visual C++ (MS Visual Studio) but this needs a lot more work. So there is still a lot more to be done with the chess logic and GUI programming. Great fun…..
Powered by WP Robot