GA nasty bug

Hi,

I am back at my Sudoku Genetic Algorithm. I made a bit of progress. But there is a nasty bug that I can not find it to fix. Please help me. Not that cross-overs and mutations are under development for now. Here is the code:

3. When posting code, do not post your entire program if you only need help with one function. Post as little as possible. People are much more likely to read small amounts of code and help you, than they are to read a hundred lines of code.

1. You need to write code with tests written, or at least a plan for testing.Test-driven development - Wikipedia
You need to know that your components work properly before you bring everything together.

2. Some functions are way too long, or way too deeply nested to ever be tested properly.

3. Your use of rand() / srand() is broken. Call srand() exactly ONCE at the start of main.

4. Your bloated macros make debugging impossible. There's no way to set a breakpoint in a macro.

5. Useless suffixes of _struct on names like Chrom_struct and Gen_prob_struct.

1. You need to write code with tests written, or at least a plan for testing.Test-driven development - Wikipedia
You need to know that your components work properly before you bring everything together.

3. When posting code, do not post your entire program if you only need help with one function. Post as little as possible. People are much more likely to read small amounts of code and help you, than they are to read a hundred lines of code.

Ok, considering the above code, let me narrow down the problem. I am very suspect of init() and correct_count() functions. Maybe bug is in them, but there is a strange phenomenon in main() function. see these parts: