• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Plot4(Difficultiyes in legal move generation).

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what I came up with but it is not correct. See the code.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic