Rodent needs a new developer

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Rodent needs a new developer

Post by PK »

There are two reasons for this decision. First, I know that I have rather busy year ahead. In itself, it is a good news, but a change in priorities will have to follow, and in my spare time I'd rather play chess. The second reason is that I feel that Rodent outpaced my programming ability. I have neither formal training nor work experience as a programmer, no working knowledge of statistics etc.

While making a long break and returning later is also an option, I'd prefer Rodent to be developed without interruptions. I like my engine and do not want to see it stall. I did my best to leave the project in good shape. It probably needs just one good push to reach 3000 Elo (CCRL scale) on a single core. And yes, as of now it can use up to 4 cores (lazy SMP).

There are really only three preconditions to become a lead developer of Rodent:

- whoever takes it, should have a couple of ideas how to improve the engine (so please look at the code and present me an idea or two)
- personality system stays in place
- Rodent stays GPL

New codebase is uploaded at https://github.com/nescitus/Rodent_III

I will add a thing or two in the next couple of weeks, then make an official release as Rodent III. I'd be grateful if somebody checked if this code compiles under Linux.

Compared to previous version, two changes stand out:

- lazy SMP
- timing and input reading is now a responsibility of a separate thread (Rodent II had some problems with replying to commands while thinking, hope it is fixed now)
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Rodent needs a new developer

Post by MikeB »

These were the errors under macOS , which may be very similar to linux , nor sure.

Code: Select all

error 1
[Mac-Pro:~/Downloads/Rodent_III-master/sources] michaelbyrne% make -j
Type make help for additional options
g++ -s -lm -g -w -Wfatal-errors -pipe -DNDEBUG -O3 -fno-rtti -finline-functions -fprefetch-loop-arrays -DBOOKPATH=/usr/share/rodentIII -o rodentIII -x c++ compile.linux
In file included from compile.linux:25:
./src/uci.cpp:169:5: fatal error: use of undeclared identifier '_sleep'
    _sleep(5);
    ^
1 error generated.
make: *** [build] Error 1

error 2
[Mac-Pro:~/Downloads/Rodent_III-master/sources] michaelbyrne% make -j
Type make help for additional options
g++ -s -lm -g -w -Wfatal-errors -pipe -DNDEBUG -O3 -fno-rtti -finline-functions -fprefetch-loop-arrays -DBOOKPATH=/usr/share/rodentIII -o rodentIII -x c++ compile.linux
In file included from compile.linux:25:
./src/uci.cpp:322:12: fatal error: no matching constructor for initialization of 'std::__1::thread'
    thread t1(task1, p, pv);
           ^  ~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:389:9: note: 
      candidate constructor template not viable: requires single argument '__f', but 3 arguments were provided
thread::thread(_Fp __f)
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:297:5: note: 
      candidate constructor not viable: requires 1 argument, but 3 were provided
    thread(const thread&);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:304:5: note: 
      candidate constructor not viable: requires 0 arguments, but 3 were provided
    thread() _NOEXCEPT : __t_(0) {}
    ^
1 error generated.
make: *** [build] Error 1

error 3
[Mac-Pro:~/Downloads/Rodent_III-master/sources] michaelbyrne% make -j
Type make help for additional options
g++ -s -lm -g -w -Wfatal-errors -pipe -DNDEBUG -O3 --std=c++11 -fno-rtti -finline-functions -fprefetch-loop-arrays -DBOOKPATH=/usr/share/rodentIII -o rodentIII -x c++ compile.linux
In file included from compile.linux:25:
./src/uci.cpp:307:4: fatal error: cannot jump from this goto statement to its label
          goto done;
          ^
./src/uci.cpp:318:7: note: jump bypasses variable initialization
  int best_depth = 0;
      ^
./src/uci.cpp:317:7: note: jump bypasses variable initialization
  int best_eng = 1;
      ^
1 error generated.
make: *** [build] Error 1


[Mac-Pro:~/Downloads/Rodent_III-master/sources] michaelbyrne% make -j
Type make help for additional options
g++ -s -lm -g -w -Wfatal-errors -pipe -DNDEBUG -O3 -std=c++11 -fno-rtti -finline-functions -fprefetch-loop-arrays -DBOOKPATH=/usr/share/rodentIII -o rodentIII -x c++ compile.linux
warning: no debug symbols in executable (-arch x86_64)
echo "SHOW_OPTIONS" > basic.ini
[Mac-Pro:~/Downloads/Rodent_III-master/sources] michaelbyrne% 
for the first error

Code: Select all

   
In file included from compile.linux:25: 
./src/uci.cpp:168:5: fatal error: use of undeclared identifier '_sleep' 
    _sleep(5);
 
this fixes it:

 //_sleep(5);
	     sleep(5);  // macos and linux
for the second error:

Code: Select all

/src/uci.cpp:322:12: fatal error: no matching constructor for initialization of 'std::__1::thread' 
    thread t1(task1, p, pv);

adding "-std=c++11" to the flag line in the makefile fixes it

CFLAGS = -g -w -Wfatal-errors -pipe -DNDEBUG -O3 -std=c++11 -fno-rtti -finline-functions -fprefetch-loop-arrays -DBOOKPATH=$(DATADIR) 
for the third error:

Code: Select all

In file included from compile.linux:25: 
./src/uci.cpp:307:4: fatal error: cannot jump from this goto statement to its label 
          goto done; 

moving this  :

int best_eng = 1;
int best_depth = 0;

before function (par_use_book) fixes it

 // get book move
	int best_eng = 1;
	int best_depth = 0;
  if (Par.use_book) {

    pv[0] = GuideBook.GetPolyglotMove(p, 1);
    if (!pv[0]) pv[0] = MainBook.GetPolyglotMove(p, 1);

    if (pv[0]) {
      MoveToStr(pv[0], bestmove_str);
	  printf("bestmove %s\n", bestmove_str);
	  move_from_book = 1;
	  goto done;
    }
  }

  // set engine-dependent variables

  Engine1.dp_completed = 0;
  Engine2.dp_completed = 0;
  Engine3.dp_completed = 0;
  Engine4.dp_completed = 0;
//  int best_eng = 1;
 // int best_depth = 0;

Code: Select all

bench 1012160 nodes searched in 809, speed 1249580 nps (Score: 2.900)
macOS exe:
https://www.dropbox.com/s/xk2ib9lb67c7i ... I.zip?dl=1

it cannot play micro tc of 20 sec/ 40 moves under xboard, but it does play although uses way too much time, 2 minutes over at move 23. Even 1 min game , 1 sec increment it goes over the time as well
xboard does not pick up the name - not sure why


[pgn][Event "Computer Chess Game"]
[Site "Mac-Pro.local"]
[Date "2017.02.16"]
[Round "-"]
[White "Crafty-25.2"]
[Black "unknown"]
[Result "1-0"]
[TimeControl "60+1"]
[Annotator "1. +0.26 1... -0.30"]

1. e4 {+0.26/20} e5 {-0.30/18 5} 2. Nf3 {+0.17/20 1.9} Nf6 {-0.26/18 5} 3.
Nxe5 {+0.48/20 2.6} d6 {-0.30/19 5} 4. Nf3 {+0.42/20 2.6} Nxe4 {-0.34/19 5}
5. d4 {+0.47/20 4} d5 {-0.26/18 5} 6. Bd3 {+0.42/20 2.5} Nc6 {-0.16/18 5}
7. O-O {+0.40/18 2.0} Be7 {-0.11/18 5} 8. Re1 {+0.39/19 1.7} O-O
{-0.20/19 5} 9. Bxe4 {+0.51/20 1.7} dxe4 {-0.24/18 5} 10. Rxe4
{+0.48/20 1.7} Bf5 {-0.42/19 5} 11. Re1 {+0.49/19 1.6} Re8 {-0.18/17 5} 12.
c3 {+0.60/18 1.8} Qd7 {-0.54/18 5} 13. Bf4 {+0.74/20 2.6} Bf8 {-0.49/18 5}
14. Nbd2 {+0.81/18 1.6} Rxe1+ {-0.54/16 5} 15. Qxe1 {+0.87/20 1.6} Re8
{-0.26/19 5} 16. Qf1 {+0.86/20 1.6} Ne7 {-0.50/20 5} 17. Re1 {+0.80/19 1.9}
Nd5 {-0.45/21 5} 18. Rxe8 {+0.80/21 1.5} Qxe8 {-0.44/22 5} 19. Bg3
{+0.79/21 1.5} Qa4 {-0.58/20 5} 20. c4 {+1.01/21 2.7} Nb4 {-0.20/21 5} 21.
Bxc7 {+0.93/20 1.5} Qxa2 {-0.27/18 5} 22. b3 {+1.03/19 1.8} Bd3
{-0.53/16 5} 23. Qe1 {+1.14/19 1.5} Nc2 {-0.48/19 5} 24. Qc1 {+1.35/18 2.6}
f6 {-0.87/18 5} 25. h3 {+1.06/18 4} Be2 {-0.73/18 5} 26. d5 {+1.60/21 1.3}
Ba3 {-0.58/22 5} 27. Qb1 {+1.59/22 1.3} Qxb1+ {-0.63/23 5} 28. Nxb1
{+1.47/23 1.3} Bxf3 {-0.63/25 5} 29. Nxa3 {+1.60/25 1.4} Nxa3 {-0.83/23 5}
30. gxf3 {+1.71/25 1.3} Kf7 {-0.90/24 5} 31. Ba5 {+1.83/25 1.4} b6
{-1.03/24 5} 32. Bd2 {+1.78/25 1.3} Nb1 {-1.07/23 5} 33. Be3 {+1.82/24 1.3}
Ke7 {-1.07/23 5} 34. Kf1 {+1.84/24 1.2} Nc3 {-1.19/22 5} 35. Bd2
{+1.88/25 2.2} Na2 {-2.16/22 5} 36. b4 {+3.09/24 2.6} Kd6 {-2.46/22 5} 37.
Ke2 {+3.19/24 1.2} a5 {-2.68/23 5} 38. bxa5 {+4.72/22 2.5} bxa5
{-2.67/22 5} 39. Bxa5 {+4.72/20 1.1} Nc1+ {-4.39/22 5} 40. Ke3
{+5.05/20 1.4} Ke5 {-4.84/24 5} 41. Bc7+ {+11.07/23 1.3} Kf5 {-12.33/23 5}
42. c5 {+11.07/22 1.1} Na2 {-12.69/23 5} 43. c6 {+12.63/21 1.1} Nb4
{-12.95/22 5} 44. Kd4 {+13.69/20 1.5} Nc2+ {-14.40/21 5} 45. Kc5
{+15.59/19 1.5} Ne1 {-15.01/22 5} 46. Bg3 {+18.42/18 1.6} Nxf3
{-14.51/19 5} 47. c7 {+22.03/16 1.1} Kg6 {-20.76/18 5} 48. c8=Q
{+24.12/16 1.6} Ng5 {-25.92/19 5} 49. Qe8+ {+327.44/18 1.3} Kh6
{-24.01/17 5} 50. d6 {+327.52/19 0.4} Nxh3 {-1000.06/16 5} 51. d7
{+327.56/15 0.2} Ng5 {-1000.05/16 5} 52. d8=Q {+327.58/13 0.2} Nh3
{-1000.04/13 5} 53. Qd4 {+327.60/11 0.2} g6 {-1000.03/10 5} 54. Qf8+
{+327.62/9 0.1} Kg5 {-1000.02/8 5} 55. Qfxf6+ {+327.64/7 0.1} Kh5
{-1000.01/5 5} 56. Qdh4# {+327.66/5 0.1}
{White mates} 1-0
[/pgn]
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Rodent needs a new developer

Post by PK »

@Michael, does the problem with the overly long thinking times go away if You modify timer_taks as follows:

Code: Select all

void timer_task() {

  Glob.abort_search = 0;

  while (Glob.abort_search == 0) {
  #if defined(_WIN32) || defined(_WIN64)
    _sleep(5);
  #else
    usleep(5 * 1000);
  #endif
    CheckTimeout(2);
  }
}