Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Mich Robinson wrote:To store the moves in chess I think you could just have arrays for the following:
From Direction Distance PawnChangedTo CapturedPiece
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I assume you know about minmax tree searching where you put on a move, swap sides, put on a move etc until you hit your maximum search depth. Then you score the position and step backwards through the tree. If you haven't done this sort of thing before then chess is probably quite a difficult game to start out on.
Not sure if that helped but ...
The distance would only apply to bishops, queens and rooks. While the direction for knights would just be a list of offsets that a knight can move to - assuming a border 2 deep surrounding the actual board making each row to be 8 + 2 + 2 = 12 places. This means the directions for a knight would just be would be { -10, -23,-25,-14,23,25,14 }. It's different for castling because there are lots of tests you need to apply but you'd just have store two special values in the king directions array to represent castling king side or queen side.fred rosenberger wrote:not sure your "Direction" and "Distance" work for Knights or Castling...
Ashish Schottky wrote:I implemented 0x88 scheme of board in representation because its eays to search for boundaries.
I think your checkers program will definitley speedup move generation if you use 0x88 board, as it doesnot require any extra checks to see whether the square is on board or not.
The above were reasons why I chose 0x88.
Have you tried it against my little applet?Ashish Schottky wrote:I implemented tict-tac-toe and connect-4
I play chess reasonably well and have written lots of game playing programs so it would be a natural thing to do but there are so many free programs that play well that it kind of put me off. But I guess people are more impressed if you tell them you've written a chess program than almost anything else thoughAshish Schottky wrote:BTW did any one of you programed a chess AI before? What were the experiences?
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
A whole board position can be stored in a 32 bit number for checkers (or so I'm told) so it's much faster and more compact to hold end game databases in this fashion. Trying to write / debug this code though would give me a headacheAshish Schottky wrote:@Mich:
I agree to what you are saying, but then there was an explanation given why 0x88 is preffered over borderd array I dont remember exactly where I read it.
perhaps ...Ashish Schottky wrote:In case if you have time then you can compare the two time differences and post it back so that other members can know.
It's a great education writing these things - the hassle with chess is that it can be an uphill struggle before you even end up with a program that plays legal moves. In another recent post someone pointed out a chess program that was only 4k long, played quite well and only took the author 6 weeks to write. I'm usually pretty good at estimating time for projects and I'm a reasonable programmer but I was amazed this guy did it in 6 weeks. Good luck with it!Ashish Schottky wrote:As of my program of chess, I decided to restart it beause it was getting very messy , generated ordinary pseudo legal moves.
Heck never thought chess to be so difficult, I learnt it quickly.
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
60 secs to do a 3 ply search is quite a lot. How many different positions is it evaluating? You may need to work on this because a program that can only look 3 ply ahead is unlikely to play strongly and most people are unlikely to want to wait more than 5 seconds to move
Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |