Can anyone tell me how to program chess?
Hi! I need your help. I have to program a chess game in Delphi, but I don''t know how to do. I made a little engine which draws the white and black tiles and I made an algorythme which puts the pieces. The array which creates the pieces is of TImage. It looks like this:
for x:= 0 to 7 do
for y:= 0 to 7 do begin
1: begin
Farmer[f]:=TImage.create(self);
Farmer[f].parent:=board1.parent;
with Farmer[f] do
begin
bringtofront;
visible:=true;
picture:=fs1.picture;
width:=48;
height:=48;
tag:=f;
whenclickedon:=Farmerwhenclickedon;
end;
end;
Then I made the whenclickedon procedure for the Farmer which lokks like this:
procedure TMainform.Farmerwhenclickedon(Sender: Tobject);
var I: Integer;
begin
I:=TComponent(self).tag;
showmessage(''Farmer number: '' + inttostr(I));
end;
This gives the createnumber of the Farmer out. And thats where I don''t know what to do then.
Farmer? lol!
You seem to be neglecting a huge issue - chess is a very complicated game and the engine that drives the AI (I assume you want to have a single player mode - all chess programs do) is a very large undertaking.
You obviously would have to know ALOT about how to play chess to effectively code it.
Now if you wanted to do, say, CHECKERS - that might be something you could realistically achieve.
I love this line "I have to program a chess game in Delphi"
That would make a great signature quote!
(I''m guessing you have a class or something and they are asking you to do this just as far as showing the pieces and moving them around - if that is the case it looks like your next step would be to decide how to select by clicking where you want the piece to move to)
DSutherland
You seem to be neglecting a huge issue - chess is a very complicated game and the engine that drives the AI (I assume you want to have a single player mode - all chess programs do) is a very large undertaking.
You obviously would have to know ALOT about how to play chess to effectively code it.
Now if you wanted to do, say, CHECKERS - that might be something you could realistically achieve.
I love this line "I have to program a chess game in Delphi"
That would make a great signature quote!
(I''m guessing you have a class or something and they are asking you to do this just as far as showing the pieces and moving them around - if that is the case it looks like your next step would be to decide how to select by clicking where you want the piece to move to)
DSutherland
there is a series of articles on the site that goes through the various things needed to program a chess game but basically if u dont know how to play the game you cant code the game.
the ai is very complicated and most likely you dont want a dumb ai. you probably would want an ai that learns from its mistakes like most chess programs do.
the ai is very complicated and most likely you dont want a dumb ai. you probably would want an ai that learns from its mistakes like most chess programs do.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement