Rodent 0.14
Moderators: hgm, Harvey Williamson, bob
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Rodent 0.14
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
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
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm
Re: Rodent 0.14
A few things to fix in your source code for portabilityPK 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
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]
http://en.cppreference.com/w/cpp/string/byte/atoi
All the other warnings are self-obvious.
Re: Rodent 0.14
I'now running Rodent 0.14 in my Open Source Bullet rating list. Result tomorrow in the tournament forum... stay tuned 
Re: Rodent 0.14
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().
Pawel Koziol
http://www.pkoziol.cal24.pl/rodent/rodent.htm
http://www.pkoziol.cal24.pl/rodent/rodent.htm
Re: Rodent 0.14
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 );
}
Re: Rodent 0.14
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: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().http://msdn.microsoft.com/en-us/library/85zk715d.aspxCode: 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 ); }
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;
}
PS: so it really wasn't that hard to write an atoull was it
Re: Rodent 0.14
Of course I know it is not portable. Portability issue was not part of the post which I replied to. I replied to this:lucasart wrote: This code is NOT portable.
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.PK wrote: .. because MSVC doesn't contain unsigned variety of atoi64().
Re: Rodent 0.14
LOLlucasart wrote:and you can add a condition like if (!is_digit(c)) throw an error or whatever if you need to.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; }
PS: so it really wasn't that hard to write an atoull was itno need for micro$oft's crap

