/Home or play chess at
......... Google App Engine ........... .... ....

Chess software for fun

svētdiena, 2012. gada 8. janvāris

Sargon chess reassembling

Sargon chess program (wiki, year ~1978) was very famous in chess programming history. Based on 8-bit Z80 processors (times of MSX, Commodore, Atari), this assembler code played decent chess game. The code was widely used in specialized chess computers - boards.
Now Sargon code runs under emulation only.
So, I've decided to find interesting things in this old assembler code and recreate some parts of it sort of modern way. Here is the result - jsSargon that runs in browser's canvas. Of course, it's kinda fake and nothing more.
Anyway, old book sources: 1, 2, also 3.
Some words about the algorithm. Simple math for counting limited by hardware. All cases of chess rules are properly assembled, not as usual before. It was strange that pawn goes forward even without any obvious motivation, but it does. Important routines are: piece exchange, square attacks, check, much code for graphics. I liked matrix of pixels for pieces in a few bytes and direction scanning (magic array) of piece movements. There is no chess knowledge at all. There wasn't.

Nav komentāru:

Ierakstīt komentāru