|
Main
Date: 02 Oct 2006 14:45:13
From: Folkert van Heusden
Subject: short algebraic notation to long algebraic notation
|
Hi, When a chessengine or user enters a SAN move, do I need to know what moves he is capable at that moment of doing? Or is it enough to know what pieces are where on the board? Folkert
|
|
|
Date: 03 Oct 2006 12:59:02
From: Simon Krahnke
Subject: Re: short algebraic notation to long algebraic notation
|
* Folkert van Heusden <[email protected] > (14:45) schrieb: > When a chessengine or user enters a SAN move, do I need to know what moves > he is capable at that moment of doing? Or is it enough to know what pieces > are where on the board? With SAN you always know: - the type of the piece that moves - the square the piece moves to - if it captures another piece or not - if it is a promotion and what kind When you have more than one piece of the indicated type, SAN almost never tells you which of the pieces is to move. I found it easiest to generate a list of legal moves and check for the one that satisfys all the constraints of the SAN string. But of course you can walk through the pieces of the indicated type and test if they cann legally move to the target square. But that needs almost the same code as the move generator. The best way might be to just generate legal moves that satisfy the contraints. With bitboards that would look like: "exd5" for white generate_legal (type = WHITE_CAPTURING_PAWN, from = pawns & white & BITBOARD_FILE(E), to = black & BITBOARD_SQUARE(D5)) "Ng2" for black generate_legal (type = KNIGHT, from = knights & black to = ~white & BITBOARD_SQUARE(G2)) "Q8xg2" for black generate_legal (type = QUEEN from = queens & black & BITBOARD_RANK(8), to = white & BITBOARD_SQUARE(G2)) If the SAN is correct this will always produce exactly one move. mfg, simon .... l
|
| |
Date: 04 Oct 2006 01:33:21
From: Simon Krahnke
Subject: Re: short algebraic notation to long algebraic notation
|
* David Richerby <[email protected] > (13:26) schrieb: > Simon Krahnke <[email protected]> wrote: >> With SAN you always know: >> >> - the type of the piece that moves >> - the square the piece moves to >> - if it captures another piece or not >> - if it is a promotion and what kind >> >> When you have more than one piece of the indicated type, SAN almost >> never tells you which of the pieces is to move. > > I assume you mean that SAN almost never tells you explicitly which of > the pieces is to move. Obviously, SAN always tells you implicitly: > otherwise, it would be ambiguous. Well, the SAN string *is* ambigous for the question from which square the piece moves. You need to look at the board to disambiguate. The only exceptions are like "a7" = > a6, "dxc1=N" => d2 or "Ra8a5" => a8. When all you have is "e4" you don't know if the pawn is black or white or whether it is currently standing on e2, e3 or e5. I tried to list what the SAN string alone tells in every case. I should have written that. mfg, simon .... l
|
| | |
Date: 04 Oct 2006 10:53:32
From: David Richerby
Subject: Re: short algebraic notation to long algebraic notation
|
Simon Krahnke <[email protected] > wrote: > David Richerby <[email protected]> (13:26) schrieb: >> Simon Krahnke <[email protected]> wrote: >>> When you have more than one piece of the indicated type, SAN >>> almost never tells you which of the pieces is to move. >> >> I assume you mean that SAN almost never tells you explicitly which >> of the pieces is to move. Obviously, SAN always tells you >> implicitly: otherwise, it would be ambiguous. > > Well, the SAN string *is* ambigous for the question from which > square the piece moves. You need to look at the board to > disambiguate. Oh, OK. That's not how I read your post but it's obvious now that we're in agreement. Dave. -- David Richerby Perforated Bulb (TM): it's like a www.chiark.greenend.org.uk/~davidr/ light bulb but it's full of holes!
|
| |
Date: 03 Oct 2006 12:26:40
From: David Richerby
Subject: Re: short algebraic notation to long algebraic notation
|
Simon Krahnke <[email protected] > wrote: > With SAN you always know: > > - the type of the piece that moves > - the square the piece moves to > - if it captures another piece or not > - if it is a promotion and what kind > > When you have more than one piece of the indicated type, SAN almost > never tells you which of the pieces is to move. I assume you mean that SAN almost never tells you explicitly which of the pieces is to move. Obviously, SAN always tells you implicitly: otherwise, it would be ambiguous. Dave. -- David Richerby Lead Bulb (TM): it's like a light bulb www.chiark.greenend.org.uk/~davidr/ that weighs a ton!
|
|
Date: 02 Oct 2006 15:47:28
From:
Subject: Re: short algebraic notation to long algebraic notation
|
Folkert van Heusden wrote: > >> When a chessengine or user enters a SAN move, do I need to know what > >> moves he is capable at that moment of doing? Or is it enough to know what > >> pieces are where on the board? > > > > You should be able to get the exact move given just the pieces on the > > board and a correctly formatted SAN move, that includes all proper > > disambiguation such as Ngf3 or Rhd1. > > Ah ok, really glad to hear that. Thanks! Note that this implies that the SAN move that you are trying to make is legal! You may need to do some checking just to make sure that a move doesn't expose the King to check, or that castling or en passant are truly legal. So, to be more precise, I should have said "given a full FEN of the position and a SAN move, you should be able to determine the exact move". jm
|
|
Date: 02 Oct 2006 10:19:37
From:
Subject: Re: short algebraic notation to long algebraic notation
|
Folkert van Heusden wrote: > Hi, > > When a chessengine or user enters a SAN move, do I need to know what moves > he is capable at that moment of doing? Or is it enough to know what pieces > are where on the board? > > > Folkert You should be able to get the exact move given just the pieces on the board and a correctly formatted SAN move, that includes all proper disambiguation such as Ngf3 or Rhd1. jm
|
| |
Date: 02 Oct 2006 23:34:50
From: Folkert van Heusden
Subject: Re: short algebraic notation to long algebraic notation
|
>> When a chessengine or user enters a SAN move, do I need to know what >> moves he is capable at that moment of doing? Or is it enough to know what >> pieces are where on the board? > > You should be able to get the exact move given just the pieces on the > board and a correctly formatted SAN move, that includes all proper > disambiguation such as Ngf3 or Rhd1. Ah ok, really glad to hear that. Thanks!
|
|