Rodent 0.14

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

PK
Posts: 913
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Rodent 0.14

Post by PK »

available for download at

http://www.koziol.home.pl/rodent.htm

- retracted some harmful search and eval changes
- pawn phalanx bonus
- opening book support (see readme file for details)

actually I planned to add a big opening book as well, as necessary code is already in place, but too many bad lines crept in. it should come with v. 0.15
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Rodent 0.14

Post by lucasart »

PK wrote:available for download at

http://www.koziol.home.pl/rodent.htm

- retracted some harmful search and eval changes
- pawn phalanx bonus
- opening book support (see readme file for details)

actually I planned to add a big opening book as well, as necessary code is already in place, but too many bad lines crept in. it should come with v. 0.15
A few things to fix in your source code for portability

Code: Select all

./book.c: In member function ‘void sBook::Init(sPosition*)’:
./book.c:35:32: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./book.c:36:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./book.c: In member function ‘int sBook::GetBookMove(sPosition*)’:
./book.c:75:25: warning: format not a string literal and no format arguments [-Wformat-security]
./book.c:130:25: warning: format not a string literal and no format arguments [-Wformat-security]
./book.c: In member function ‘void sBook::AddLineToGuideBook(sPosition*, char*, int)’:
./book.c:194:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./book.c: In member function ‘void sBook::AddLineToMainBook(sPosition*, char*, int)’:
./book.c:234:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./book.c: In member function ‘void sBook::SaveBookInOwnFormat(char*)’:
./book.c:322:89: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘U64 {aka long long unsigned int}’ [-Wformat]
./book.c: In member function ‘void sBook::ParseBookEntry(char*, int)’:
./book.c:355:57: error: ‘_atoi64’ was not declared in this scope
./book.c: In member function ‘void sBook::FeedMainBook()’:
./book.c:403:47: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./book.c:406:36: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./search/search.c: In member function ‘int sSearcher::Search(sPosition*, int, int, int, int, int, int, int, int*)’:
./search/search.c:253:63: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
./search/search.c: In member function ‘int sSearcher::CountLegalMoves(sPosition*, int)’:
./search/search.c:465:50: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
./search/report.c: In member function ‘void sSearcher::DisplayPv(int, int*)’:
./search/report.c:59:10: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./search/report.c:65:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./search/report.c:70:73: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘U32 {aka long unsigned int}’ [-Wformat]
./search/report.c: In member function ‘void sSearcher::DisplaySpeed()’:
./search/report.c:82:39: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘U32 {aka long unsigned int}’ [-Wformat]
./search/quiescence.c: In member function ‘int sSearcher::Quiesce(sPosition*, int, int, int, int, int*)’:
./search/quiescence.c:64:39: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
./selector.c:198:2: warning: "/*" within comment [-Wcomment]
./parser.c: In member function ‘void sParser::UciLoop()’:
./parser.c:59:27: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
./parser.c: In member function ‘void sParser::PrintUciOptions()’:
./parser.c:163:86: warning: too many arguments for format [-Wformat-extra-args]
./parser.c:164:83: warning: too many arguments for format [-Wformat-extra-args]
./parser.c: In member function ‘void sParser::ParsePosition(sPosition*, char*)’:
./parser.c:188:29: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Note that _atoi64 is not supported by the ANSI/ISO C++ standard. atoll() is the correct one to use, because the standard defines 64 bit as long long (hence the "ll") while __int64 and the likes are microsoft specific (dating back to the time when there was no standard for 64 bit computing in C/C++)
http://en.cppreference.com/w/cpp/string/byte/atoi

All the other warnings are self-obvious.
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Rodent 0.14

Post by lucasart »

I'now running Rodent 0.14 in my Open Source Bullet rating list. Result tomorrow in the tournament forum... stay tuned :D
PK
Posts: 913
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Rodent 0.14

Post by PK »

is there by chance a function called atoull() ? if so, it would allow me to do away with an ugly hack currently hash keys for the opening book are truncated, because MSVC doesn't contain unsigned variety of atoi64().
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Rodent 0.14

Post by rvida »

PK wrote:is there by chance a function called atoull() ? if so, it would allow me to do away with an ugly hack currently hash keys for the opening book are truncated, because MSVC doesn't contain unsigned variety of atoi64().

Code: Select all

#include <stdio.h>

unsigned __int64 atoui64(const char *szUnsignedInt) {
   return _strtoui64(szUnsignedInt, NULL, 10);
}

int main() {
   unsigned __int64 u = atoui64("18446744073709551615");
   printf( "u = %I64u\n", u );
}
http://msdn.microsoft.com/en-us/library/85zk715d.aspx
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Rodent 0.14

Post by lucasart »

rvida wrote:
PK wrote:is there by chance a function called atoull() ? if so, it would allow me to do away with an ugly hack currently hash keys for the opening book are truncated, because MSVC doesn't contain unsigned variety of atoi64().

Code: Select all

#include <stdio.h>

unsigned __int64 atoui64(const char *szUnsignedInt) {
   return _strtoui64(szUnsignedInt, NULL, 10);
}

int main() {
   unsigned __int64 u = atoui64("18446744073709551615");
   printf( "u = %I64u\n", u );
}
http://msdn.microsoft.com/en-us/library/85zk715d.aspx
This code is NOT portable. As far as the standard is concerned there is no atoull, so you *have* to write it yourself for full portability (if you really need an unsigned long long instead of a long long version). Here's an easy way to write a portable atoull:

Code: Select all

#include <inttypes.h>

uint64_t atoull(const char *s)
{
  uint64_t x = 0;
  char c;
  while (c = *s++) {
    x *= 10;
    x += c - '0';
  }
  return x;
}
and you can add a condition like if (!is_digit(c)) throw an error or whatever if you need to.

PS: so it really wasn't that hard to write an atoull was it :D no need for micro$oft's crap
User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Re: Rodent 0.14

Post by rvida »

lucasart wrote: This code is NOT portable.
Of course I know it is not portable. Portability issue was not part of the post which I replied to. I replied to this:
PK wrote: .. because MSVC doesn't contain unsigned variety of atoi64().
and I recommended using _strtoui64() instead, which is MSVC specfic. It is not hard to write a wrapper around it (and use #ifdef _MSC_VER) to be portable.
mar
Posts: 2685
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Rodent 0.14

Post by mar »

lucasart wrote:

Code: Select all

#include <inttypes.h>

uint64_t atoull(const char *s)
{
  uint64_t x = 0;
  char c;
  while (c = *s++) {
    x *= 10;
    x += c - '0';
  }
  return x;
}
and you can add a condition like if (!is_digit(c)) throw an error or whatever if you need to.

PS: so it really wasn't that hard to write an atoull was it :D no need for micro$oft's crap
LOL :lol: