>> evalVal = minimax( depth + 1, otherPlayer( player ), boardCopy, &chosenMove );
This line is within the minimax() function. Here, chosenMove is already a pointer, so you don't need to pass it's address.
>> evalVal = minimax( depth + 1, otherPlayer( player ), boardCopy, &chosenMove );
This line is within the minimax() function. Here, chosenMove is already a pointer, so you don't need to pass it's address.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
WOW i changed the last lines of minimax function to
and i lost 3 times in a row!!Code:if (mode==MAXIMIZE) return max; else return min;
By the way i still haven't swapped this
back yet because for some reason it plays very bad if i do it. I think this is anothr implementation bug.Code:if ( mode == MINIMIZE ) if ( evalVal > max) { max = evalVal; chosenMove->row = listMoves[ counter ].row; chosenMove->col = listMoves[ counter ].col; } else if ( mode == MAXIMIZE ) if ( evalVal < min ) { min = evalVal; chosenMove->row = listMoves[ counter ].row; chosenMove->col = listMoves[ counter ].col; }
But thanks a 'lot' PJYelton. You're so cute ^.^, ( i mean your avatar);
but chosenMove is a structure? Does that make a difference?
Also,,i found that losing 3 times is just a coincidence..
There is still the generateMoves() bug which reports the wrong number of moves. But it could be errors in other functions which are causing this.
Last edited by Nutshell; 01-24-2003 at 06:39 PM.
I looked over the new source and made some changes, tell me if they work or not! I can't test it since when I try running with MSVC++ it doesn't like a lot of your things like KB_HIT and gotoxy etc. I also commented where I made the changes. I only really looked at the minimax function though!
Hi,
The code compiles, but it doesn't run. I could not choose the game mode, nothing responds. It compiles, but doesn't run properly.
Also, i realli thought of your way to undo the move, but you haven't taken into account to undo the 'flipped' pieces, and turn them back into their color before.
I've attached the compiled exe. I also tried only changing the
But the compiled result is the same, didn't work.Code:if ( player == 'X' ) mode = MAXIMIZE else mode = MINIMIZE
Oops, you're right about the changed pieces, guess you need the loop then. I have no idea why its not working now, all I changed was the stuff in the minimax function, none of which should have done anything...
The only thing I can think of at the moment would be to go back to your last working version and make the changes that I wrote about. Try that and see what happens. My changes should in no way screw up the rest of the program like that since you haven't even called minimax yet!
Let me know what happens!
Nope, the same thing occurred, exe doesn't work. And that is troubling me too, minimax isn't called on yet!!
Ugh,,,,my heads gonna explode.
I'll play my piano for a while..
This problem is so illogical.
Did you try going back to your last working source code and making the changes I wrote down?
Yes, but the compiled exe won't work if i made those changes, not even one.
But it works without the changes?? Doesn't make any sense! Go back to the last working exe, make one change at a time, and test it. See where it is screwing up. But make sure that the the source works first before changing anything.
That's what i tried. Can you please try it? I've attached the files required to compile my code, if you have time, pls try it yourself.
I need keys.h first.
When you added one change at a time and ran it, at what point did it screw up?