This week's book giveaway is in the Kotlin forum.We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering OS Languages Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# Plot4(Difficultiyes in legal move generation).

Ashish Schottky
Ranch Hand
Posts: 93
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.
int count=0;
for(i=0;i<posn.length;i++)
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 .

Ashish Schottky
Ranch Hand
Posts: 93
Here is what I came up with but it is not correct. See the code.

 With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.