File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Plot4(Difficultiyes in legal move generation).

 
Ashish Schottky
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I came up with but it is not correct. See the code.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic