Problems include the RANDOM LIBRARIES, in a console project, in Windows.
I used the Random libraries of Boost collection. I have implemented it in my program. A program for the chess analysis . Now, at compile time I have no problem. Everything ok, the console project is compiled without errors. During run time, the functions of Boost Random libraries, correctly generate a random number. But after a few repetitions of the loop (from 2/3 to a few tens of loops), the program crashes. The strange thing that the crash does not occur in the functions where I use the random functions, but occurs in the chess engine that does not use these functions, and thus in theory should not be influenced by it. But if I do not use the functions of Boost library and use the basic function of C + + (rand ();) I have no problems.
I work in Windows. My project is a console project compiled with VC + +2010.
Also I have wrote a test program with VC + +2010, which generates a sequence of random numbers, using Boost libraries. In this case I have no problems. Only when I implement the libraries in the chess program I have problems. So it seems that your libraries are in conflict with the chess engine. What do you recommend for the search for the cause of the problem?
The headers and the function use by me in my program:
#include
On 7/15/2013 3:48 PM, Alberto Aliberti wrote:
I used the Random libraries of Boost collection. I have implemented it in my program. A program for the chess analysis . Now, at compile time I have no problem. Everything ok, the console project is compiled without errors. During run time, the functions of Boost Random libraries, correctly generate a random number. But after a few repetitions of the loop (from 2/3 to a few tens of loops), the program crashes. The strange thing that the crash does not occur in the functions where I use the random functions, but occurs in the chess engine that does not use these functions, and thus in theory should not be influenced by it. But if I do not use the functions of Boost library and use the basic function of C + + (rand ();) I have no problems. I work in Windows. My project is a console project compiled with VC + +2010. Also I have wrote a test program with VC + +2010, which generates a sequence of random numbers, using Boost libraries. In this case I have no problems. Only when I implement the libraries in the chess program I have problems. So it seems that your libraries are in conflict with the chess engine. What do you recommend for the search for the cause of the problem?
Use the IDE debugger and when the program crashes look at the call stack to see where it crashes and why it is happening.
Thank you, I solved the problem. It was my simple mistake.
Error:
example: I have 7 moves, it are represented by a vector "moves [i]", where "i" is the index moves = n. moves.
So in this case will have a vector "moves [i]" with i = 0 to 6.
With the basis random function of C, to obtain with n. moves = i = 7, a number from 0 to 6, I have write: i=rand() % i;
With the Boost random functions I have to write: boost::random::uniform_int_distribution<> dist(0,i-1);
I was wrong, because I wrote Boost function as C function, and not subtract a unit (I wrote (0, i) instead of (0, i-1). So I obtained the moves with an index vector from 0 to 7.
But the move index 7 did not exist and bitboard the chess engine going to crash.
Now everything works ok with this correction. No problem
________________________________
Da: Edward Diener
I used the Random libraries of Boost collection. I have implemented it in my program. A program for the chess analysis . Now, at compile time I have no problem. Everything ok, the console project is compiled without errors. During run time, the functions of Boost Random libraries, correctly generate a random number. But after a few repetitions of the loop (from 2/3 to a few tens of loops), the program crashes. The strange thing that the crash does not occur in the functions where I use the random functions, but occurs in the chess engine that does not use these functions, and thus in theory should not be influenced by it. But if I do not use the functions of Boost library and use the basic function of C + + (rand ();) I have no problems. I work in Windows. My project is a console project compiled with VC + +2010. Also I have wrote a test program with VC + +2010, which generates a sequence of random numbers, using Boost libraries. In this case I have no problems. Only when I implement the libraries in the chess program I have problems. So it seems that your libraries are in conflict with the chess engine. What do you recommend for the search for the cause of the problem?
Use the IDE debugger and when the program crashes look at the call stack to see where it crashes and why it is happening. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Alberto Aliberti
-
Edward Diener