My honor is worth more than your accusations. I wrote some compression algorithms a few years ago, but everything I read about compression indicated it was a patent minefield. I guess in the last year or two most of you think that nobody can have original work anymore. Even cloners accuse other people of cloning their clones. It's funny to me the person willing to help me the most was one of the people who I actually copied from. I really had no intention of releasing an engine, or any program, which violated any copyright, patent, or intellectual property of anybody. There are so many tutorials and example code, that sometimes it's hard to tell what is free domain and what isn't.
Code: Select all
/// Check for console input. Original code from Beowulf and Olithink
// I copied it from Stockfish.
#ifndef _WIN32
int data_available()
{
fd_set readfds;
struct timeval timeout;
FD_ZERO(&readfds);
FD_SET(fileno(stdin), &readfds);
timeout.tv_sec = 0; // Set to timeout immediately
timeout.tv_usec = 0;
select(16, &readfds, 0, 0, &timeout);
return (FD_ISSET(fileno(stdin), &readfds));
}
#else
int data_available()
{
static HANDLE inh = NULL;
static bool usePipe;
INPUT_RECORD rec[256];
DWORD dw, recCnt;
if (!inh)
{
inh = GetStdHandle(STD_INPUT_HANDLE);
usePipe = !GetConsoleMode(inh, &dw);
if (!usePipe)
{
SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
FlushConsoleInputBuffer(inh);
}
}
// If we're running under XBoard then we can't use PeekConsoleInput() as
// the input commands are sent to us directly over the internal pipe.
if (usePipe)
return PeekNamedPipe(inh, NULL, 0, NULL, &dw, NULL) ? dw : 1;
// Count the number of unread input records, including keyboard,
// mouse, and window-resizing input records.
GetNumberOfConsoleInputEvents(inh, &dw);
// Read data from console without removing it from the buffer
if (dw <= 0 || !PeekConsoleInput(inh, rec, cf_min(dw, 256), &recCnt))
return 0;
// Search for at least one keyboard event
for (DWORD i = 0; i < recCnt; i++)
if (rec[i].EventType == KEY_EVENT)
return 1;
return 0;
}
#endif
I found this code snippet in my own code that I intended to use when I implemented the infinite analysis feature, which I never got around to. Stockfish took it from Beowulf/Olithink, who may have gotten it from somewhere else. Stockfish gives credit in its source, but who owns this code? And what license is it under? Where is this GPL license line drawn? What about everything on chessprogramming.wikispaces.com? I could easily rewrite the SEE function and a pawn evaluation in assembly and be done with it, but now that I've made this post, I'll be permanently labeled a copier and cheat. My honor means more to me than anything; I'm sorry that I intended on making some money possibly selling something while I was going to school rather than making $7.99/hour cooking food.
My original intention was to see what everybody thought on the difference between that of my code and Crafty/Stockfish. My SEE function looks pretty different, especially the part where I save the last valuable attacker for a given square. I haven't seen that ANYWHERE, but since I posted it here, what's the license? Is it included with the rest of Blackmail in GPLv3 released below? Maybe there's a few other small pieces of code I've forgotten about.
Code: Select all
if ( AreStringsEqual(command, "XBOARD") ) {
comm->protocol = PROTOCOL_XBOARD;
GlobalMode = GLOBALMODE_ENGINE;
return GLOBALSTATE_NOOP;
} else if ( AreStringsEqual(command, "USER") ) {
comm->protocol = PROTOCOL_USER;
GlobalMode = GLOBALMODE_ENGINE;
RecvCommunication_User(comm, "new");
return GLOBALSTATE_NOOP;
} else if ( AreStringsEqual(command, "SERVER") ) {
comm->protocol = PROTOCOL_SERVER;
GlobalMode = GLOBALMODE_SERVER;
return GLOBALSTATE_NOOP;
} else if ( AreStringsEqual(command, "QUIT") ) {
return GLOBALSTATE_QUIT;
}
What about snippets like this? How many different ways can you seriously think of to check which command a user/interface has sent to an engine? There's this way, in Crafty and Beowulf, and then there's the Stockfish way, which essentially works like a stream tokenizer and makes more sense for the uci protocol.
I've also read many articles written by others, such as Larry Kaufman (something about pawns if I remember right, including a game lost by black due to a tripled pawn), the Mediocre chess blog (the author of which has posted here), and countless (I mean countless, I could never give an entire list) others. I have read every thread on this forum, save the very long ones, especially where arguments broke out. I know enough to know that I don't understand butterfly bitboards, and don't like 0x88 move generation over the bitboard approach I'm currently using. There was a post about a service Intel provided where you could test thread concurrancy on a multithreaded application which would run for an hour on their test server. But the service doesn't exist anymore
Anyway, the source code for my engine can be downloaded from the following link. The GPLv3 is included in the .zip file
http://www.chrisflorin.com/blackmail/source.zip
To use Blackmail, type the user command similar to using xboard or uci (uci is not supported). Using Blackmail in user mode is similar to xboard, you must use "usermove" before you type your move. Most other xboard commands work in user mode, but there are a few others:
checks: displays all moves which are checks
perft [depth]: displays the perft count for the given position
perftsplit [depth]: displays the perft count for each move in the given position
score: returns the current eval (divide by 65536 to normalize a pawn to 1.00)
see [move]: returns the see score for a given move (type a move just like usermove)
analyzeall: displays the exact score and pv line for all moves for the given position. uses the same time clock as a normal search would
The only clock types which work are sd (search depth) and st (search time), which are used exactly the same as in winboard. The defaults are 30 and 15 respectively.
The hashtable defaults to 8M entries, which is 128M, and 64K pawn entries. There is no command to change this; it must be changed in the source. Chess Engine VII.cpp: 78.
If you run a few games overnight or something, it crashes in Arena, but only every few games. When doing Blackmail vs. Blackmail tests, they would both crash or neither would crash; it's weird and was never only one of them. I could never figure out why and have been dealing with it.
I thought it was pretty cool that Onno Garms posted an idea of having an engine process PV nodes, ALL nodes, and CUT nodes differently, but he didn't know of an engine that did. Blackmail does. I wanted to tell him myself. You'll find the Bad Move Reduction in Blackmail commented out, it didn't work out too well.
You'll find some code that I started making game databases, opening books, and end game table bases. I was satisfied with the thinking aspect of my engine, and had intended starting auto tuning, but we'll see if I continue. Perhaps I'll find another project, but I don't know. Artificial Intelligence is one of my passions, and if this is anything like compression, I'm out. It's funny how I was warned this would happen, but refused to listen. I told myself that with something original, I could pull through. Maybe I'll just go back to assembly programming where example code doesn't even exist especially since once you see something, it cannot be unseen.
So, here's my contribution to the community. Thanks for the help. Special thanks goes to the authors of Beowulf, Crafty and Stockfish for their code. Special thanks also goes out to everybody who researches for a living and posts their results free for all to see. Also to authors of articles and code on chessprogramming.wikispaces.com, and anybody involved on helping people learn and understand chess programming on these forums. Oh, and Rebel for move ordering and evaluation ideas. I'm sure I'm missing a few, it's late and I have to get up for work in 6 hours.
There is nothing regarding Ippolit in Blackmail; I looked at the source for 3 minutes and decided it was not in my best interest to get anything from it. Sorry guys, but the code just looked ugly to me.