Re: Chess boards & connections.




<dynamics@xxxxxxxxxxxx> wrote in message
news:1145600495.849018.281690@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Toshi ikutsu? wrote:
<dynamics@xxxxxxxxxxxx> wrote in message
news:1145569228.272184.92380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Michael Stemper wrote:
In article <1145555339.841442.203250@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
dynamics writes:
Trying to calculate if I can write a Chess AI.

I need to define all possible boards.

I have a total of 64 different pieces, 16 for Black
and 16 for White to start, and since each pawn
can be promoted, to either a Queen or Knight, a

They can't be promoted to a bishop or a rook?

LOL, then you'll totally *** my math, actually
I have a patch, but you're right ;-) .

what about "in passing" for pawns?
and castling?


further 16 for B&W's 8 pawns for another 32.

There are 65 locations on the board, 8*8 + 1 for
non-existance called the side bar.

So I dimension an Array, (64,65) where the 64
provides the *serial number* for all possible
pieces and each of those can be in 65 locations,
providing 64*65=4160 boards.

Nope.

Place the first of the 64 pieces. How many choices for a square do
you have? 65. Now, for each of those possibilities, you have 64
choices
for placing the second piece. So, two pieces already uses up your 4160
boards. If you place a third piece, you'll have 63 available squares
for each of those 4160 possibilities, or 65*64*63 = 262080. To place
64 pieces on 65 squares -- even with disallowing two pieces on the
same
square from the start -- you're going to have 65! possible boards.

I'd say that, since each player can only have 16 pieces at any time,
you number the pieces 1-16 (or 0-15 if you prefer), and keep track of
what type of piece (Q, K, Kt, p, etc.) each one is. This way, you only
have 32 pieces to deal with. Then, you probably should get rid of your
"sidebar" and just not necessarily have all of the pieces included in
the board at any time.

You are too complicated. All I needed was the 2D Array
I defined by matrix (64,65) defining all boards.

too limited. try checkers instead.

Ok, you might be right, I was thinking we
could go through all 64 Pieces (as defined
in the OP) and output a Location (0-64) like,

Location (P) = L

where P => 1 to 64 and L=>0 to 64,

to describe any possible chess board.

Is that true?

you are approaching it as a linear array problem, and that will lead to
complications (slowdown) when calculating possable moves. (indexing
simplifies - 2 D array for board position)

You also need to evaluate possable moves per map, 3 to 10 moves ahead



.