Rodent 0.14

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
PK
Posts: 755
Joined: Mon Jan 15, 2007 10:23 am
Location: Warsza
Contact:

Rodent 0.14

Post by PK » Thu Apr 19, 2012 2:43 pm

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

User avatar
lucasart
Posts: 2957
Joined: Mon May 31, 2010 11:29 am
Contact:

Re: Rodent 0.14

Post by lucasart » Thu Apr 19, 2012 3:04 pm

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.

User avatar
lucasart
Posts: 2957
Joined: Mon May 31, 2010 11:29 am
Contact:

Re: Rodent 0.14

Post by lucasart » Thu Apr 19, 2012 3:39 pm

I'now running Rodent 0.14 in my Open Source Bullet rating list. Result tomorrow in the tournament forum... stay tuned :D

PK
Posts: 755
Joined: Mon Jan 15, 2007 10:23 am
Location: Warsza
Contact:

Re: Rodent 0.14

Post by PK » Fri Apr 20, 2012 8:55 am

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 10:00 am
Location: Slovakia, EU

Re: Rodent 0.14

Post by rvida » Fri Apr 20, 2012 9:02 am

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&#40;const char *szUnsignedInt&#41; &#123;
   return _strtoui64&#40;szUnsignedInt, NULL, 10&#41;;
&#125;

int main&#40;) &#123;
   unsigned __int64 u = atoui64&#40;"18446744073709551615");
   printf&#40; "u = %I64u\n", u );
&#125;
http://msdn.microsoft.com/en-us/library/85zk715d.aspx

User avatar
lucasart
Posts: 2957
Joined: Mon May 31, 2010 11:29 am
Contact:

Re: Rodent 0.14

Post by lucasart » Fri Apr 20, 2012 11:04 am

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&#40;const char *szUnsignedInt&#41; &#123;
   return _strtoui64&#40;szUnsignedInt, NULL, 10&#41;;
&#125;

int main&#40;) &#123;
   unsigned __int64 u = atoui64&#40;"18446744073709551615");
   printf&#40; "u = %I64u\n", u );
&#125;
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&#40;const char *s&#41;
&#123;
  uint64_t x = 0;
  char c;
  while &#40;c = *s++) &#123;
    x *= 10;
    x += c - '0';
  &#125;
  return x;
&#125;
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 10:00 am
Location: Slovakia, EU

Re: Rodent 0.14

Post by rvida » Fri Apr 20, 2012 11:34 am

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: 1832
Joined: Fri Nov 26, 2010 1:00 pm

Re: Rodent 0.14

Post by mar » Fri Apr 20, 2012 12:16 pm

lucasart wrote:

Code: Select all

#include <inttypes.h>

uint64_t atoull&#40;const char *s&#41;
&#123;
  uint64_t x = 0;
  char c;
  while &#40;c = *s++) &#123;
    x *= 10;
    x += c - '0';
  &#125;
  return x;
&#125;
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:

Post Reply