Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: more help with move generator

Author: Lieven Clarisse

Date: 03:39:35 01/16/03

Go up one level in this thread


This should bring you a little closer to your goal, it is by no means a working
example, but will show you how to get started.


#include <string.h>


{
moves[3]= {"e2e4", "d2d4", "c2c4"}; //I assume these are the legal moves
 //the current position

//---> better and more general is this:

generatemoves(boardrepresentation, moves);
//boardrepresentation can be any object reprenting the current board position
//moves is defined by char moves[100][10] (place for 100 moves)

getline(input);

if (!strcmp(input,moves[0]) || !strcmp(input,moves[1]) !strcmp(input,moves[2]))
//you probably want this in a seperate function, using a for loop
 //so you can use it in general, using any number of moves
 {
 domove(boardrepresentation, input);
 move=evaluate_board(boardrepresentation);
 }

else cout <<"invalid move" << endl;

return move;     // reply move to be displayed from the evaluated position.
}






This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.