Plot4 also known as Captains Mistress and connect four.
I am facing difficulties in legal move generation.
I have googled, put on other help forums but the explanations were not so easy to implement.
Hope I get help here.
I have gone through the discussion on developing the tic-tac-toe(Though his board representation can only be used for square boards.) in the same forum, named 'Turn Based Strategy Games'.
(please refer to this discussion as there is lot info which is not practicable to put here.)
This helped me a lot while I made the GUI.
I am now faced with the task of making a set of legal move generation.
this would be the array which will be then passed to the negamax().
I have almost used the code from Fred Hamilton. but have few questions.
Is programing games in strings a good idea as compared to bitmaps and normal integer arrays?
Here I have a pseudo code.
if there is a legal move, then list[count++]=new move(i,0)
but then all the empty spaces are not legal moves.
So what should be done here?
Now let us come to the evaluation function.
Take a look at the following code .
When I wrote this evaluation, the game play became very slow at depth of 4. It took approx 60 seconds in critical positions.
Does the array representation make it faster?
if yes, then i will convert this into 2d-char array and use the two for loops to compare.
The eval() using array is not a big problem but the legal move generation is .
posted 6 years ago
Here is what I came up with but it is not correct. See the code.