Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Chess library in Prolog

83 views
Skip to first unread message

Sergii Dymchenko

unread,
Jan 28, 2015, 6:13:32 PM1/28/15
to
Hi,

Is there an open source chess library for Prolog? I can't find any.

What I'm looking for is an implementation of the chess rules, so I can submit queries like "what moves are possible in this position?"

-Sergii.

rupert...@googlemail.com

unread,
Jan 29, 2015, 9:07:22 AM1/29/15
to
Not sure, but here is an article about implementing the rules of chess in SQL. It should not be too hard to translate this into Prolog:

http://www.sqlteam.com/article/sqlchess-a-tutorial-on-thinking-in-sets

Rupert

Jan Burse

unread,
Jan 29, 2015, 12:06:27 PM1/29/15
to
Hi,

Hi,

The hProlog distribution contains a Chess Program written
in Prolog, see here somewhere:
http://people.cs.kuleuven.be/~bart.demoen/hProlog/

And this one has also a Chess Programm written in
Prolog, Ivan Bratko Book (ZIP at the End)
http://www.pearsoned.co.uk/highereducation/resources/bratkoprologprogrammingforartificialintelligence3e/

Not sure whether an SQL based Chess would be a gas
or any help here. Especially since I don't find
the so called "next article":

"Before we start looking at the "deeper"
chess rules in the next article we will
continue with basic piece movement and
examine the paths that pieces travel
over when moving."
http://www.sqlteam.com/article/sqlchess-a-tutorial-on-thinking-in-sets

Did he dieded?

Bye

rupert...@googlemail.com schrieb:

rupert...@googlemail.com

unread,
Jan 30, 2015, 9:56:48 AM1/30/15
to
On Thursday, January 29, 2015 at 5:06:27 PM UTC, Jan Burse wrote:

> Not sure whether an SQL based Chess would be a gas
> or any help here. Especially since I don't find
> the so called "next article":
>
> "Before we start looking at the "deeper"
> chess rules in the next article we will
> continue with basic piece movement and
> examine the paths that pieces travel
> over when moving."
> http://www.sqlteam.com/article/sqlchess-a-tutorial-on-thinking-in-sets
>
> Did he dieded?

I couldn't find article 2 either...

Joe Celko's book "Thinking in Sets" also has a section on implementing the rules of chess. I think it would help, since the whole point of this book is to teach how to use SQL in terms of sets/relationships or predicate calculus. The chess part builds on those foundations, so it ought to be suitable for implementing in Prolog without too much work.

Rupert

Paul Sephton

unread,
Feb 2, 2015, 2:15:53 AM2/2/15
to
The problem is that chess rules depend on the state of the game. For example, en-passant can only be done with a pawn which moved two spaces at outset. Castle can only be done if neither king nor rook involved has moved before.

So when you ask "what moves are possible in this position?", the answer is sometimes "it depends".

Just because I like a challenge, I built such an implementation myself. Not great, but it works after a fashion. You can view/download it at:

http://codebin.org/view/dd47c306

Have fun
0 new messages