Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: About Fafis...

Author: Roman Hartmann

Date: 02:37:03 05/28/05

Go up one level in this thread


On May 27, 2005 at 16:59:07, Alex Schmidt wrote:

>After Patriot 2.0 was discovered to be a Fruit clone we searched for methods to
>find out Crafty clones.
>
>After hours of testing different methods I first created a testsuite with only
>two kings on the board. Since all moves are a draw the move by the engine
>depends exclusively on the movegenerator.

If the move generators work the same way that could be possible without sharing
any code. But it's a first hint that an engine could be a clone. Not producing
the same moves would not automatically outline cloning as you can change the
order in which the moves are created easily, of course.

>I tested all UCI engines and only 4 did always the same moves as Crafty.
>Including Fafis X 0.2 UCI.

I strongly suspect some chess programers might have 'borrowed' the move
generator from crafty. Maybe also the author of Fafis.

>Of course there are not so much possibility in which order the movegenerator
>generates the moves, so this means nothing.
>
>I expanded the test with positions where many different moves are a mate in 1.
>The problem with this is that even different Crafty versions play different
>moves here. Only 2 UCI engines played always the same move as Crafty 19.03,
>including Fafis X 0.2 UCI.
>
>Michael Diosi and Christopher Conkie had the nice idea to try illegal positions
>like this:
>
>4QNkB/1K1K1NPR/5RRR/8/8/8/7k/8 w - - 0 1
>
>The engine has lots of possibilities to handle this position. Most capture the
>king on h2, but Crafty mates the other king with Ne6 with the score +M1. Only
>two engines do the same move with the same score, including Fafis X 0.2 UCI.

That's certainly a bit odd. But then again that might be because both programs
handle that just the same way.

>Or strange legal positions like this mate in 1:
>
>1QqQqQq1/r6Q/Q6q/q6Q/B2q4/q6Q/k6K/1qQ1QqRb w - - 0 1
>
>Crafty calculates in the background and gives no output, like Fafis.
>
>This all made Fafis very suspicious. We contacted the author because he was
>thinking about getting commercial. After what happened with Patriot we asked him
>to show his source to an expert like Dann Corbit. Rafael claimed there is no
>Crafty code inside Fafis and promised to show the source before the next free or
>commercial release to Dann.

Maybe he just doesn't like to show his source code. I can understand that.

But I agree that the similar behaviour of Fafis might be due copying parts of
crafty code but still I don't see convincing proof for that. Why not comparing
the decompiled code to the one from crafty before going public?

>Two or three days later Fafis 2.0 was out, and the source was not shown to Dann.
>Maybe you remember, that was the engine with the virus.
>
>In the meantime another one looked inside Craftys code and searched for a way
>for a real proof. And he found something very interesting. Crafty has a very
>special feature regarding fen positions. I will show you an example, look
>exactly on the wrong fen string, and on Crafty's internal position:
>
>White(1): setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBXR w - - 0 1
>White(1): display
>
>       +---+---+---+---+---+---+---+---+
>    8  |<R>|<N>|<B>|<Q>|<K>|<B>|<N>|<R>|
>       +---+---+---+---+---+---+---+---+
>    7  |<P>|<P>|<P>|<P>|<P>|<P>|<P>|<P>|
>       +---+---+---+---+---+---+---+---+
>    6  |   | . |   | . |   | . |   | . |
>       +---+---+---+---+---+---+---+---+
>    5  | . |   | . |   | . |   | . |   |
>       +---+---+---+---+---+---+---+---+
>    4  |   | . |   | . |   | . |   | . |
>       +---+---+---+---+---+---+---+---+
>    3  | . |   | . |   | . |   | . |   |
>       +---+---+---+---+---+---+---+---+
>    2  |-P-|-P-|-P-|-P-|-P-|-P-|-P-|-P-|
>       +---+---+---+---+---+---+---+---+
>    1  |-R-|-N-|-B-|-Q-|-K-|-B-| . |   |
>       +---+---+---+---+---+---+---+---+
>         a   b   c   d   e   f   g   h
>
>White(1): setboard rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKB*R w KQkq - 0 1
>White(1): display
>
>       +---+---+---+---+---+---+---+---+
>    8  |<R>|<N>|<B>|<Q>|<K>|<B>|<N>|<R>|
>       +---+---+---+---+---+---+---+---+
>    7  |<P>|<P>|<P>|<P>|<P>|<P>|<P>|<P>|
>       +---+---+---+---+---+---+---+---+
>    6  |   | . |   | . |   | . |   | . |
>       +---+---+---+---+---+---+---+---+
>    5  | . |   | . |   | . |   | . |   |
>       +---+---+---+---+---+---+---+---+
>    4  |   | . |   | . |   | . |   | . |
>       +---+---+---+---+---+---+---+---+
>    3  | . |   | . |   | . |   | . |   |
>       +---+---+---+---+---+---+---+---+
>    2  |-P-|-P-|-P-|-P-|-P-|-P-|-P-|-P-|
>       +---+---+---+---+---+---+---+---+
>    1  |-R-|-N-|-B-|-Q-|-K-|-B-|   |-R-|
>       +---+---+---+---+---+---+---+---+
>         a   b   c   d   e   f   g   h
>
>White(1): go
>ERROR!  board[6]=-4, should be 0
>
>In the first position everything after the x in the fen string is cut off, in
>the second position the x is replaced by a * and now just one piece is missing.
>The * is handled as a special case in Crafty.
>
>I tested this now with Fafis X 0.2 UCI and a corrupted fen with the
>startposition:
>
>973500>1:setboard
>xnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w - - 0 1
>977295>1:go
>977420<1:info depth 1 seldepth 4 score cp 1 time 0 nodes 7
>pv e1f2
>977425<1:info nps 7 cpuload 100 tbhits 0
>977429<1:info depth 2 seldepth 7 score cp 1 time 1 nodes 14
>pv e1f2 e8d7
>977434<1:info nps 1400 cpuload 100 tbhits 0
>977437<1:info depth 3 seldepth 10 score cp 1 time 2 nodes 32
>pv e1f2 e8d7 f2g3
>
>I placed the x at the beginning of the fen string. Fafis handles this now like
>an empty board, moveing the two kings -> Everything after the x is cut off.
>
>2425051>1:setboard
>*nbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w - - 0 1
>2426315>1:go
>2426437<1:info depth 1 seldepth 4 score cp 775 time 0 nodes
>27 pv e2e4
>2426442<1:info nps 27 cpuload 100 tbhits 0
>2426446<1:info depth 2 seldepth 7 score cp 716 time 1 nodes
>68 pv e2e4 d7d5
>2426451<1:info nps 6800 cpuload 100 tbhits 0
>2426456<1:info depth 3 seldepth 10 score cp 744 time 2 nodes
>172 pv e2e4 d7d5 b1c3 d5e4 c3e4
>
>After replaceing the x with the * Fafis plays now from the startposition, the
>score is +7 so probably just the black rook is missing.
>
>I did the tests with the older UCI version of Fafis because the free releases
>don't support the setboard command. It is not possible to analyse positions. I
>only tested the kingmoves with the free Fafis and they are the same as in
>Crafty.
>
>The strings are hidden in all Fafis versions, but a friend of us found a way to
>see the strings and compared Fafis 2.1 with Crafty 18.01:

That's certainly a bit odd to hide the strings in a free available chess engine,
still not proof for clonging though.

>For example:
>
>fafis.exe has : "Fafis> Error! feature %s rejected by xboard"
>crafty1801n.exe has : "ERROR.  feature %s rejected by xboard".
>
>fafis.exe has : "Fafis> Error captured a king!!"
>crafty has : "captured a king"

I guess most programmers had a look at the sources of crafty at least once. I
mean how many ways are there to write 'captured a king'? (Personally I don't
know though why a king ever should be captured. But crafty/fafis seem to operate
that way) Would be interesting to see if the routines are identical as the same
output can stem from very different shaped code. Again, looking at the assembly
could help here.

>Here is the tool:
>
>http://www.sysinternals.com/ntw2k/freeware/procexp.shtml
>
>I checked all UCI engines with this methods and they seem to be all clean of
>Crafty code. Just with one or two I am not sure yet...
>
>If one of you want to test WB engines, here is my epd test:
>
>4k3/8/8/8/8/8/8/4K3 w - - 0 0 bm e1f2;
>4k3/8/8/8/8/8/5K2/8 b - - 1 1 bm e8d7;
>8/8/2k5/8/8/6K1/8/8 w - - 0 0 bm g3h4;
>8/8/8/1k6/7K/8/8/8 w - - 0 0 bm h4h5;
>8/8/8/1k5K/8/8/8/8 b - - 1 1 bm b5a4;
>8/8/7K/8/k7/8/8/8 b - - 1 1 bm a4a3;
>8/7K/8/8/8/8/k7/8 w - - 0 0 bm h7h8;
>7K/8/8/8/8/8/k7/8 b - - 1 1 bm a2a1;
>7K/8/8/8/8/8/8/k7 w - - 0 0 bm h8g8;
>6K1/8/8/8/8/8/8/k7 b - - 1 1 bm a1b1;
>6K1/8/8/8/8/8/8/1k6 w - - 0 0 bm g8h8;
>7K/8/8/8/8/8/8/1k6 b - - 1 1 bm b1a1;
>8/8/5k2/8/3K4/8/8/8 b - - 1 1 bm f6f5;
>8/8/5k2/8/3K4/8/8/8 w - - 0 0 bm d4d5;
>2k5/8/1K6/8/8/8/8/8 w - - 0 0 bm b6a7;
>2k5/8/2K5/8/8/8/8/8 w - - 0 0 bm c6d6;
>8/3k4/8/1K6/8/8/8/8 w - - 0 0 bm b5b6;

This is a very good way to narrow down the suspects but not proof that an engine
is a clone though.

>You can test an engine automatically with it, a few seconds/move are enough.
>
>But remember: If an engine 'solves' all positions it is no evidence at all for a
>clone!! It's just a little hint to take a closer look on it.

Closer look would mean that you dive a bit into the sources, or if not
available, have a look at the output from a decompiler and compare it with
Fruit/Crafty/Faile/TSCP/Gnuchess ....

>Many thanks to all helping people!!
>
>Best,
>Alex

Good work. Well done! Personally I just would like to see that someone would
also have a look at the decompiled code of the suspected engine and compare it
with the one from crafty/fruit ... just to be on the safe side before going
public.

Roman



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.