"Gurudas Bhandarkar" wrote:Please take a look at the code. The method get_Move is not executing and I wrote many print statements to see where exactly its going wrong, but didn't get it.
fred rosenberger wrote:i didn't dig in too deep, but this is just ugly:
and i'm not sure it makes sense.
i think sq is supposed to hold the position of a move (which makes it a poor choice for a name). Why do you assign a value STORED in the array to it, then make sure that value is less than the LENGTH of the array?
In other words, if I had an array that holds 3 ages, why would you only do something while those ages are less than three? and then if I change the size of my array, but leave the values the same, it could radically change the flow of my program.
My advice is to get your OXO program working first and then start again on the connect 4.
In the other thread you said the only thing that wasn't working here was the evaluation function. It now appears that nothing is really working here.
If you don't know why get_move isn't called then just put a print at the start and end of each method and another inside each loop and if statement. Send all the output to a log. Go through the log looking for the point when the get_move should of been called but wasn't. You have now found your bug. If you're just starting out in programming then it may be better working on simpler applications than game playing as this area can be quite complex - especially if you want the program to win.
There is also no point in providing all the code and asking others to debug it. It would be far quicker for you just to download some code to play. If you want to do it yourself then you have to learn to debug your code - you won't get anywhere without doing this.
I have written this as I want my legal_Moves to be traversed from 0 to its maximum index.
Gurudas Bhandarkar wrote:Hello every one, I have completed my game with primitive evaluation.
The code has both Negamax alone and with alpha-beta pruning.
Gurudas Bhandarkar wrote:I want to make a perfect connect four player. What are your opinions?
Who is Mr Allis?
Its that I would like to give plain code to people who try to help me so that they can draw their own conclusions.
You have no debugging code in your program - I'm guessing you're just assuming the program is playing correctly?
This negamax routine is wrong because it is negating all evaluations (Line 235) while it is supposed to negate only the Min side of the MinMax evaluation.
We commented on the code you supplied as we cannot see what's on your hard drive from here
As it stands that program is full of errors and simply plays the first move it finds unless the next move is a win.
I put in a reasonable amount of time into analyzing that code and I suggest you put in a similar amount of time to read the comments that people have made and then implement the changes suggested.
Gurudas Bhandarkar wrote:BTW what code are you talking about?
BTW just a question - did you programed connect four or maybe any game like this before?
I doubt if anyone will download and run code from people they don't know. People also have very limited time to debug
other peoples code (and I certainly spent too long looking at yours) so they won't try and keep up with different copies of your code.
fred rosenberger wrote:I looked at what you have posted on the web site...the link in the original post.
Please explain to me, in detail and with examples, how this could POSSIBLY be correct code:
I see no reason to look at anything else when this is so wrong. Convince me it is correct.
However if its OK with other members here, then I can upload entire source code here.
Rather annoyingly it beat me on it first run
Gurudas Bhandarkar wrote:@Mich
I (My Program)played 3 games with your applet and your applet is too good for my program to beat.(2-1 in your favor).
I like the way you have implemented the applet. How did you do that animation/blinking of texts and dots, used threads? BTW nice interface too.
What algorithm did you choose to program, also how did you implement your evaluations and at what depth is your program searching, mine searched at 10 plys. just asking to learn more, if its your secret then I won't probe more?
"Ulf Dittmer" wrote:Does that mean you're a better developer than Connect 4 player?
"Ulf Dittmer" wrote:Any chance of a Java 5 version?
What advantages does Java 5 offer? Does it take much to change over?
Mich Robinson wrote:It should play for you now then
Is it a Mac you're using?
Gurudas Bhandarkar wrote:I have now developed two algorithms for searching wins.
However, both seem to give absurd results.
I say this because when algorithm2 plays as player 2 it wins and loses to algorithm1 when plays as player 1.
Gurudas Bhandarkar wrote:Also please how to implement some algorithm by which the program self learns the game and I am satisfied even it takes 1000 games to play and then choose the right path for playing perfect game as player 1.
Gurudas Bhandarkar wrote:I am unable to edit the post as well
Always! Wait. Never. Shut up. Look at this tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton