Author: Mark Rawlings
Date: 08:20:41 02/22/04
Go up one level in this thread
Hi Dave- I'm currently trying your first method for check detection (test if king is in check by generating the next ply of possible moves, then checking the "to" squares to see if it matches the king's square). I'm guessing that it will slow things down quite a bit, though. Your suggestion of a "super piece" sounds like a great idea! I'm just hoping I can get it to work... Thanks, Mark On February 21, 2004 at 16:32:42, David Mitchell wrote: >On February 20, 2004 at 11:37:51, Mark Rawlings wrote: > >>Hi Steve- >> >>Here's my story... >> >>I had always dreamed of writing a chess program, but never started because I >>thought it would be too difficult. A number of years ago I decided to start with >>a simpler game and chose mancala. It was a lot of fun programming it and took >>quite awhile to do. I still work on it from time to time and it's extremely >>strong now. I used the book "Kasparov vs Deep Blue" as my main source of >>information to get the search working, etc. It was just right for a >>"non-programmer." (I've also been reading ccc daily since it started, which >>helped, too.) >> >>Anyway, my 12-year old son started learning TrueBasic in school this year and a >>month or so ago announced that he was going to write a chess program. (He had >>previously written a tic-tac-toe program.) Well, after about two weeks he had a >>program that could generate legal moves and had a simple evaluation with no >>search. You could still play a game against it, though. Just yesterday, I >>helped him work out the last few bugs in the search and now he has a complete >>program! It's very slow right now because of the complicated "check" routine >>and we don't have a TruBasic compiler either. He may be able to use the schools >>compiler, which would help. >> >>I was pretty amazed at his efforts and it gave me the push I needed to start my >>own chess program. (I'm using QuickBasic.) To make a long story short, I now >>have a chess program that's not too bad! (I'm working my way up the "trainer >>levels" in Chess Tiger for Palm as a sparing partner for it.) I'm still trying >>to figure out how to test for check and checkmate so it still makes some illegal >>moves, and I haven't incorporated en passant yet. What it does now is to keep >>on playing even after a king is captured! I'm looking forward to years of >>tinkering with it! (Working on it right now...) >> >>Good luck with your program! >> >>Mark >> >> >>On February 19, 2004 at 09:51:41, S J J wrote: >> >>> >>> After reading posts for three years, I'm ready to make a first >>>feeble attempt at a program. Odss are that checkers would be >>>the best place to cut my teeth. >>> >>> Can anyone recommend any books or web pages that would give a >>>novice programer a start to writing checkers and chess programs? >>> >>>Best Regards, >>>Steve "No Moore's Law" J > >When I started coding up my program, I checked to see if my king was in check by >generating the next ply of possible moves, then checking the "to" squares to see >if my king's sqr was on it. (I keep track of where both kings are at all times). >It worked fine, but it also gave me a headache having to do that, so I scrapped >that and now use the idea of the super piece put on my king's sqr, and check to >see if, in any of the possible piece moves from that square, I run into any >piece of that type. (ie, while checking knight moves, do I run into the >opponent's knight). If so, obviously I'm in check. > >There's a better way to do this, which centers around the last move by the >opponent. I don't use it however. The super piece idea works fine. > >To check for checkmate, I check for InCheck status, and if so, generate the next >ply of pseudo legal moves, and see if I have just one that will get me out of >check. If so, the game is still on, otherwise, I'm mated. > >If IsLegal() can find no legal moves, and I'm not in check, then I know it's a >stalemate. > >dave
This page took 0 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.