Connect 4 Headachev
I'm programming a player class to plug into Connect 4 application (GUI) using the minimax algorithm.
I have most of my code already and I would like to post it but it is sitting at just under 400 lines at the moment.
The problem I have lies with one of my evaluation functions. After that, my minimax could do with some help too.
For my evaluation function, it further calls two methods, one checks a column, the other checks a row. I have no idea which one of these two methods is wrong or whether they are both wrong. So I have tested it by commenting out the second method.
The first method appears to be the problem:
This happens: although I set the code up to terminate when it gets to row index 5 on the board grid, I have guards to check this as well, the program still wants to proceed to row 6 for some reason.
I've checked my variables so many times, but I can't find anything wrong.
Also, my minimax code only seems to work if I am in the MIN player, if I set myself as the MAX player, it falls over.
I used the minimax algorithm at ai- depot.com. The MIN and MAX methods that are called by method MINIMAX are very similar, so I don't think the error lies in method MAX... but then who knows, I've probably missed something as per usual :p
I would really appreciate some assistance, I have most of the code so I am not asking for someone to do my homework.
If you are interested in helping me, I would send my code over and maybe we can discuss it over Messenger or something.
Thanks in advance. :WAVE: