A Chess forum. ChessBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ChessBanter forum » Chess Newsgroups » rec.games.chess.computer (Computer Chess)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , ,

How to program an FICS chess client



 
 
Thread Tools Display Modes
  #1  
Old October 9th 08, 05:58 AM posted to rec.games.chess.computer
Roland
external usenet poster
 
Posts: 3
Default How to program an FICS chess client

Hello,

I want to program an internet chess client. My objective is to keep
the code size as small as possible(small memory foot-print also).

Basically what I need is:

-Legal move detection(see which moves are allowed).
-Checkmate/Stalemate detection
-threefold repetition detection
-send commands to server and parse answers from server.

So where can I read the basic algorithms used to do this so I don't
need to reinvent the wheel?

I was reading about bitboards, but I guess this would be overkill
because I'm not making a chess engine, only a client.

How about interacting with the server? Is there any documentation on
how to handle this, how to parse server messages?

Thanks for any feedback!

Roland

PS: Please don't answer to the email. I rarely read it and it's full
of spam.
Ads
  #2  
Old October 9th 08, 03:49 PM posted to rec.games.chess.computer
David Richerby
external usenet poster
 
Posts: 2,591
Default How to program an FICS chess client

Roland wrote:
Basically what I need is:

-Legal move detection(see which moves are allowed).
-Checkmate/Stalemate detection
-threefold repetition detection
-send commands to server and parse answers from server.


I believe that threefold repetition detection would be illegal on
FICS, as it counts as assistance to the player. (Remember that
threefold repetition does not end the game -- it merely gives a player
the right to claim a draw.)

You don't need to detect checkmate or stalemate because the server
will tell you that the game is over and why. Also, I don't think you
actually need to do legal move detection, since the server won't let
you make an illegal move. If I recall correctly, the protocol sends
moves by quoting the source and destination square, so (I think) you
wouldn't even need to parse strings like `Nab3', just `a5b3'. But
you'll need to detect castling (the king just moved two squares so
shift the rook, too) and en passant (a pawn just captured to an empty
square so delete the pawn on the square behind it).

So I think you should be able to do this with almost no `chess
programming'. That said, it would probably be better to do legal move
checking yourself as letting the server do it adds lag if the player
does make an illegal move. (And I used to make illegal moves quite
often. If I picked up a piece with the mouse and decided not to move
it after all, I'd drop it on top of one of my own pieces. This is
guaranteed to be an illegal move so the piece returns to its original
square. Manually returning it to its square is risky because you
might put it on the wrong square and make a move by mistake.)


Dave.

--
David Richerby Hungry Cat (TM): it's like a cuddly
www.chiark.greenend.org.uk/~davidr/ pet but it'll eat you!
  #3  
Old October 9th 08, 06:27 PM posted to rec.games.chess.computer
Roland
external usenet poster
 
Posts: 3
Default How to program an FICS chess client

So I think you should be able to do this with almost no `chess
programming'. That said, it would probably be better to do legal move
checking yourself as letting the server do it adds lag if the player


Exactly! So what is the best way to do legal move detection?
  #4  
Old October 9th 08, 08:56 PM posted to rec.games.chess.computer
Simon Krahnke
external usenet poster
 
Posts: 244
Default How to program an FICS chess client

* Roland (18:27) schrieb:

So I think you should be able to do this with almost no `chess
programming'. That said, it would probably be better to do legal move
checking yourself as letting the server do it adds lag if the player


Exactly! So what is the best way to do legal move detection?


Well, the simplest thing to test a Is there a piece of your own color
on the destination square and is there a piece of your own color on the
source square?

Everything else is way more complicated and nothing you should start
with. Get the client working and if tf there is a lag, work on that.

mfg, simon .... l
  #5  
Old October 17th 08, 08:03 PM posted to rec.games.chess.computer
Roland
external usenet poster
 
Posts: 3
Default How to program an FICS chess client


Well, the simplest thing to test a Is there a piece of your own color
on the destination square and is there a piece of your own color on the
source square?

Everything else is way more complicated and nothing you should start
with. Get the client working and if tf there is a lag, work on that.


No it's not that complicated, I've been a programmer for many years.
And I want to start collecting info now so that when I get to code the
relevant parts I already have it. I mean, legal move detection is a
basic for any chess program and I was assuming there are already well
known and discussed algorithms for doing that. Am I wrong? Can anyone
provide me with pointers or do I have to reinvent the wheel? Does
every chess program author implement his own legal move detection?
  #6  
Old October 18th 08, 02:01 AM posted to rec.games.chess.computer
Simon Krahnke
external usenet poster
 
Posts: 244
Default How to program an FICS chess client

* Roland (20:03) schrieb:

Well, the simplest thing to test a Is there a piece of your own color
on the destination square and is there a piece of your own color on the
source square?

Everything else is way more complicated and nothing you should start
with. Get the client working and if tf there is a lag, work on that.


No it's not that complicated, I've been a programmer for many years.


Then you probably heard about "do the simplest thing that can possibly
work".

And I want to start collecting info now so that when I get to code the
relevant parts I already have it. I mean, legal move detection is a
basic for any chess program and I was assuming there are already well
known and discussed algorithms for doing that. Am I wrong? Can anyone
provide me with pointers or do I have to reinvent the wheel? Does
every chess program author implement his own legal move detection?


That's normally not needed. All you need to have is pseudo legal move
generation (moving in the right direction and not jumping over pieces)
and a detection for illegal positions where the king is in check[1].

That's all you need for inside the search. If you need to test or parse
a move for legality you can generate a list of pseudo legal moves and
filter the illegal ones out by doing them and checking the result. Then
you can lookup the move to be tested/parsed in the list.

You can look for algorithms in the chess programming wiki. There are
also special tests that test moves inside the search, needed for killer
moves.

But chess engines and front ends have very different performance
requirements.

mfg, simon .... l

[1] Okay, castlings are a little more complicated.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 May 8th 06 06:24 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 April 23rd 06 06:21 AM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 January 3rd 06 07:04 AM
Wikipedia Biography of Eric Schiller Sam Sloan rec.games.chess.misc (Chess General) 2 December 22nd 05 09:02 PM
rec.games.chess.misc FAQ [2/4] pribut@yahoo.com rec.games.chess.misc (Chess General) 0 November 18th 05 06:36 AM


All times are GMT +1. The time now is 12:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Content Relevant URLs by vBSEO 2.4.0
Copyright ©2004-2008 ChessBanter, part of the NewsgroupBanter project.
The comments are property of their posters.
Debt Consolidation - Credit Reports - Free phpBB forum - Loans - Mortgages