Why to write another chess game implementation when there are so many (good) ones outside? This is certanly a good question. But when I tried to play chess with my friend, in all those possibilities, none of them satisfied us. We just wanted to play chess, not to read all the options of a big manpage or to start the X server just to play a game.
We thought it would be simpler just to write a simple and light implementation of chess than adapting ourselfs to some options-full X program. So we did! Haskell was the language of choice, it's a very elegant language and we wanted to learn more about it. Some friends started using our chess for its simplicity and then we thought it would be a good idea to make it public.
The program implements almost every chess functions, so that you can play a game regularly. The Check and Mate check's are not yet full writen, but some part of the code is already done. The main function does not have access to this code, so that it doesn't change the program behaviour.
It's written in Haskell, a functional language that can make powerfull things in very few lines of code. The choice was because of it simplicity and because it's very easy to read and mantain. The program is almost fully functional, only with the main functions that are IO related using Monads. It requires the GHC compiler to work.
You can get Xadrez from Savannah. The nightly CVS snapshot is available, and you can get the cvs with anonymous login.
Extract the .tar.gz file with:
$ tar zxf xadrez-haskell-sources.tar.gz
Then change to the dir:
$ cd xadrez-haskell/
And build it:
To install it (after make):
# make install
If you have installed the program then simply run:
If you haven't installed:
If you are running Cygwin, it's a good
choice to compile it with the binary output to xadrez.exe instead of
just xadrez. To do it build with:
$ make BIN=xadrez.exe
And install it with:
# make install BIN=xadrez.exe
-p PORT, --port PORT
xadrez -p 1010
xadrez -p 1010 -s
If you start Xadrez as server you'll have to wait for the other player's connection, otherwise you must type the sever's IP. After that the game starts. When it's the other player's turn you just wait for him to make his move. When the turn is your's you should use one of the following commands in the prompt to make your move: