now tell if my idea of the board was ok!
how can i score a position?
NEED HELP ON A CHESS PROGRAM IN C++!!
You could value every possible move based on the value of the piece. Then do the highest value move.
i agree.
it is not worth losing a pawn to capture the queen, when that pawn was protecting other pieces (YOUR queen, the king, whatever). for a decent AI you''ll have to factor in which pieces are blocking other''s, as well as which pieces are "protecting" something else or preventing one of the opponent''s moves.
--- krez (krezisback@aol.com)
it is not worth losing a pawn to capture the queen, when that pawn was protecting other pieces (YOUR queen, the king, whatever). for a decent AI you''ll have to factor in which pieces are blocking other''s, as well as which pieces are "protecting" something else or preventing one of the opponent''s moves.
--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Sorry Krez, I actually deleted my post (between yours and js_530''s) as I felt that it was something akin to what js_530 was trying to suggest: i.e., that the value of a move should be related to the value of a piece. I was simply saying it the other way round: that the value of a piece should be related to the value of its moves, whihc should include the NULL move.
Timkin
Timkin
timkin,
why would you do something like that? with all the worthless posts laying around (language holy wars, flames based completely on opinion rather than the topic, and whatnot) one of your comments hardly deserves to be deleted. redundancy isn''t such a bad thing
--- krez (krezisback@aol.com)
why would you do something like that? with all the worthless posts laying around (language holy wars, flames based completely on opinion rather than the topic, and whatnot) one of your comments hardly deserves to be deleted. redundancy isn''t such a bad thing
--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
November 19, 2001 09:28 PM
quote: Original post by krez
i agree.
it is not worth losing a pawn to capture the queen, when that pawn was protecting other pieces (YOUR queen, the king, whatever). for a decent AI you''ll have to factor in which pieces are blocking other''s, as well as which pieces are "protecting" something else or preventing one of the opponent''s moves.
I disagree. If you look several moves ahead, then the score would work out to be lower if its possible for your opponent to kill another important piece. In other words, in order to determine the score, you would have to go through all your opponents possible moves and determine the lowest possible score by recursing. Only on the final recursion would it look at the value of the pieces. If you did it like this, it would realise that if it gave up this pawn and took this queen, and it did so-and-so move, then it would be impossible to save your own queen.
quote: Original post by Anonymous Poster
I disagree. If you look several moves ahead, then the score would work out to be lower if its possible for your opponent to kill another important piece. In other words, in order to determine the score, you would have to go through all your opponents possible moves and determine the lowest possible score by recursing. Only on the final recursion would it look at the value of the pieces. If you did it like this, it would realise that if it gave up this pawn and took this queen, and it did so-and-so move, then it would be impossible to save your own queen.
hmm... you said you disagree, but that was exactly my point! by looking at the possible consequences of a seemingly "good" move, the AI could discover that it might not really BE a good move (the computer would decide not to kill the player''s queen, to save its own queen two turns later). remember, we WANT the AI to be able to play a good game.
it is not practical to have the computer check all possibilities for every turn until the end of the game, as it would take far too long. i think i read somewhere that a human can only think ahead three or so turns in a chess game (although this is a vague memory, and it could be inaccurate). so, if the AI calculated it''s probabilities for the next two or three turns, it should be able to play a decent game against a person.
i have another idea about this AI too. perhaps it could be programmed to look for certain patterns that could lead to a multi-move strategic move. i am not a good enough chess player to give a real-life example (a friend of mine who cares about chess WAY too much beat me in five moves once, with some strategy that he set up and i walked right into; and, he said there was actually a NAME for that series of moves too, although i don''t recall what it was). but, my point is, if the computer notices a certain pattern of pieces on the board it can start the sequence of moves. then, each following turn, it can check if the opponent''s move "blocked" this strategy (by putting a piece in the way, or capturing a key piece, or whatever). if not, it continues with the sequence. this is repeated until the strategy fails or is completed successfully.
these patterns would not necessarily cover the whole board, it could be as simple as the opponent''s bishop being in a certain spot in relation to the computer''s rook and knight; as long as there is room on the board (not too close to the edges, with no pieces blocking the important moves) the "strategy sequence" is valid and the AI can attempt to pull it off.
the patterns could be coded into the program (or in a data file of some sort), or possibly be "learned" (if the AI is really "smart"; i know little to nothing about this though, i am speaking in theoretical terms) after playing many games.
ha, this has probably already been done, or discounted, by those AI people who love chess (was it "deep blue" that beat that grandmaster chess player? i always get it confused with "deep thought" from HGTG!). but, it is fun to talk about it here.
so, anyone think i am completely wrong? or (more hopefully) does anyone have any similar thoughts?
damn, i might have to start programming a chess game now.
--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
okay, i hope nobody is annoyed by my rambling...
my previous posts were mainly about how the AI could form a decent "attack" strategy against a player, but upon clicking the "reply to topic" button i realized that it should be defensive also.
in addition to checking which of it''s pieces are under attack in the next turn, it should look at the opponent''s pieces for these "attack strategy patterns" i was rambling about in my last post. if it sees that the player is in the correct formation, and seems to be following the pattern, it would attempt to stop it (either by blocking some moves with other pieces, moving the pieces that are in danger, putting the opponent''s queen in danger, whatever).
oh, and it should also try to protect it''s pieces when they are wandering in dangerous territory. if you do not know what i mean (not to insult anyone''s intelligence), it is like so: say the AI has an opportunity to capture the player''s rook with a bishop. the player moves his queen to protect the rook; that is, he positions the queen so that if the rook is captured, he can capture the offending bishop immediately afterwards. the queen is protecting the rook. this doesn''t always work, as the player might be willing to sacrifice the bishop for the rook, but it is generally a good strategy.
any comments?
--- krez (krezisback@aol.com)
my previous posts were mainly about how the AI could form a decent "attack" strategy against a player, but upon clicking the "reply to topic" button i realized that it should be defensive also.
in addition to checking which of it''s pieces are under attack in the next turn, it should look at the opponent''s pieces for these "attack strategy patterns" i was rambling about in my last post. if it sees that the player is in the correct formation, and seems to be following the pattern, it would attempt to stop it (either by blocking some moves with other pieces, moving the pieces that are in danger, putting the opponent''s queen in danger, whatever).
oh, and it should also try to protect it''s pieces when they are wandering in dangerous territory. if you do not know what i mean (not to insult anyone''s intelligence), it is like so: say the AI has an opportunity to capture the player''s rook with a bishop. the player moves his queen to protect the rook; that is, he positions the queen so that if the rook is captured, he can capture the offending bishop immediately afterwards. the queen is protecting the rook. this doesn''t always work, as the player might be willing to sacrifice the bishop for the rook, but it is generally a good strategy.
any comments?
--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
To Krez: that might be an average player that can look ahead 3 moves. It''s not uncommon for a Grandmaster to look ahead 10-12 or even more moves, and of course, they aren''t looking at EVERY possible move, they only look at the handful of best moves which makes it much easier.
As far as determining the best move in a given position, read this article on the MinMax search algorithm.
http://www.seanet.com/~brucemo/topics/minmax.htm
It is written by Bruce Moreland who is the author of one of the strongest computer chess programs in the world (although he doesn''t make it publicly available). His program named Ferret beat Deep Fritz (generally recognized as the best program in the world today) in a tournament a while back. Ferret went on to win the tournament.
Anyway, he''s got some good articles there about chess programming, but most of it is about the AI part of the program. Gamedev.net also has an article about chess programming. I can tell several of you don''t really know a lot of the basics about how a chess program works, so I would suggest (if you want to learn) reading some of Bruce''s articles and reading the article abotu chess programming here on gamedev. Here''s another good webpage that has some good info on chess program AI: http://www.galahadnet.com/chess/chessprg/
My advice if you want to write your own chess program is to read up on those articles and search for others, and basically get familiar with the concepts invovled before you start our writing your own chess program.
If you''re into USENET, you can post questions to rec.games.chess.computer and you''ll get many good answers to your questions. Bruce Moreland posts there, as well as Bob Hyatt (author of Crafty, another very strong program) and many other people who are very knowledgable in the field of computer chess programming. I know a lot about computer chess programming, but these guys blow my knowledge out of the water.
As far as determining the best move in a given position, read this article on the MinMax search algorithm.
http://www.seanet.com/~brucemo/topics/minmax.htm
It is written by Bruce Moreland who is the author of one of the strongest computer chess programs in the world (although he doesn''t make it publicly available). His program named Ferret beat Deep Fritz (generally recognized as the best program in the world today) in a tournament a while back. Ferret went on to win the tournament.
Anyway, he''s got some good articles there about chess programming, but most of it is about the AI part of the program. Gamedev.net also has an article about chess programming. I can tell several of you don''t really know a lot of the basics about how a chess program works, so I would suggest (if you want to learn) reading some of Bruce''s articles and reading the article abotu chess programming here on gamedev. Here''s another good webpage that has some good info on chess program AI: http://www.galahadnet.com/chess/chessprg/
My advice if you want to write your own chess program is to read up on those articles and search for others, and basically get familiar with the concepts invovled before you start our writing your own chess program.
If you''re into USENET, you can post questions to rec.games.chess.computer and you''ll get many good answers to your questions. Bruce Moreland posts there, as well as Bob Hyatt (author of Crafty, another very strong program) and many other people who are very knowledgable in the field of computer chess programming. I know a lot about computer chess programming, but these guys blow my knowledge out of the water.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement