SANKit

SANKit originated from Steven J. Edwards in 1993, then updated in 1994. Amazingly this C source code compiled with almost no warnings 18 years later.

What you will find here is the original code with some additions and a very small number of bug fixes, reformatted into a more readable format.

In addition, some C++ programs demonstrates how to leverage the base code, and can be used as the basis for your own programs. 


+++ Join the sankit-news Mail Group to get notified of significant changes, and the sankit-svn-submits to monitor file updates. +++


The C++ programs:

******************
PGN_Creator (in progress)
******************
Input each half move in loose PGN (piece-square1-square2) or in an ASCII board format, and create pristine PGN for the game that you can then share or publish.
******************

******************
PGN_Player
******************
Supply a file with one or more PGN games in it, and this program reads the first game, parses it, then lets you replay it. You can request each  board in an easily parseable ASCII format, or examine each square on each board. This capability would make it quite easy to create a graphical program that lets a person load a PGN game, then see each board after each half move.

******************

******************
PGN_Cleaner
******************
This program takes two arguements, the first an input file containing one or more PGN game reports. The program feeds the PGN through Edward's progam, and outputs pristine PGN into the output file. Developers could test their PGN generation code against this source, or anyone publishing PGN could insure that what's posted is in fact true "export" PGN.

Since is would be difficult by hand to reconstruct the gameboard where the reported error occurred, this program outputs three boards around the play, so you can verify for yourelf that Steven Edwards program is in fact correct when it reports an error.

Why does it matter? Well, sloppy PGN can lead the reader into thinking that a player had additional options available when in fact they did not.
 
This program can also parse the game report full move by full move, if someone wanted to reformat the plays. For example:

---
Error: game 90 play mismatch: "7. O-O Nge7" "7. O-O Ne7"  [Original file PGN, correct PGN]

bR :: bB bQ bK :: bN bR
bP bP ::    :: bP bP bP
   :: bN ::    ::    ::
:: wB bB bP ::    ::   
   ::    ::    ::    ::
::    ::    :: wN ::   
wP wP wP ::    wP wP wP
wR wN wB wQ wK    :: wR


bR :: bB bQ bK :: bN bR
bP bP ::    :: bP bP bP
   :: bN ::    ::    ::
:: wB bB bP ::    ::   
   ::    ::    ::    ::
::    ::    :: wN ::   
wP wP wP ::    wP wP wP
wR wN wB wQ :: wR wK   


bR :: bB bQ bK ::    bR
bP bP ::    bN bP bP bP
   :: bN ::    ::    ::
:: wB bB bP ::    ::   
   ::    ::    ::    ::
::    ::    :: wN ::   
wP wP wP ::    wP wP wP
wR wN wB wQ :: wR wK   
---

So we see that some program has provided a pgn half-move of "Nge7", when in fact it should have been "Ne7". Looking at the board, we see that yes, there are two Knights that are "in play" for the "e7", but only one can be moved, as moving the other would have put the King into check.
 
*********************

This SourceForge project has taken the original source code, addressed some warnings, then added a mode and a feature.

The flag, "CLI",  allows the source to be include in other projects that wish to use the source as a library.


CHANGES:

- turned on all warnings and each one (function prototypes, mismatched format strings, etc).

- using the latest llvm/clang compiler, analyzed the code and addressed all reported concerns.

- reformatted the code to "K&R" style to make it more readable (Stephen's original style was quixotic to say the least). [I did this to the original code before I submitted it, so you can easily see my changes relative to the reformated original in svn.]

- added numerous CLI ifdefs, so you could extract out just the "engine" without the CLI components.

- added NAG code and comments (both input and output).

- added an Xcode project for OSX developers, while also updating the Makefile.

WHAT'S INCLUDED

docs:  the original documentation

SanKitCLI:  an Xcode (OSX) project to build and run the CLI and/or the PGNcleaner

original_archive:  the original 1994 zip file containing all original materials (preserved for decades by Chris Johnson at http://cfajohnson.com/chess/SAN)

src: the SVN managed code. The Sourceforge repository has as the original submission reformated using "uncrustify". The uncrustify config file is also available in the src directory so anyone can re-verify that the original code mas modified as claimed (uncrustify is also available on sourceforge).
	

RELEASES

1.5.0 Jan 21, 2012
- added PGN_Player
- fixed a couple of minor bugs

1.2.5 Jan 17, 2012
- added debugging information for game with unparsable text
- fixed a problem with PGN records containing only "0-1" or "1-0"
- fixed a problem where long games caused memory corruption

1.2.0 Jan 15, 2012
- first release of the PGNcleaner utility

1.1.0 Never Uploaded

1.0.0 Dec 29, 2011
- first release with the original code and modifications I made to the source over the past two years


SUPPORT

The current supporter will address code bugs. You are on your own to figure out how to use this code. Plan on budgeting a fair amount of time to read, re-read, and experiment with the documentation and code. The original author provided virtually no comments, and given the sort cryptic names you will need to spend a fair amount of time understanding how the various parts work. You will not get any support for "how do I do such and such" - you are on your own!
