Forums

How do I create a FEN string?

Sort:
P-k3

that notation places a piece on the board so if I want to replace that piece with a number does fen allow that?

MrEdCollins
P-k3 wrote:

is there a way to number all 64 squares?  So all squares have a number on them

A number on them?  Yea, there's lots of ways.  Here's one:

01-02-03-04-05-06-07-08
09-10-11-12-13-14-15-16
17-18-19-20-21-22-23-24
25-26-27-28-29-30-31-32
33-34-35-36-37-38-39-40
41-42-43-44-45-46-47-48
49-50-51-52-53-54-55-56
57-58-59-60-61-62-63-64

Here's another:  

81-82-83-84-85-86-87-88
71-72-73-74-75-76-77-78
61-62-63-64-65-66-67-68
51-52-53-54-55-56-57-58
41-42-43-44-45-46-47-48
31-32-33-34-35-36-37-38
21-22-23-24-25-26-27-28
11-12-13-14-15-16-17-18

(file, row)

In this numbering format, square 84, for example, is the 8th row, 4th file, from White's point of view.

Though as Stephen mentioned, it's hard to beat algebraic.

P-k3

thank you

homernh
stephen_33 wrote:

Some great advice above but nobody's actually answered the OP's question: Once you've dragged all the pieces to their proper places on the board in Position Setup mode (Analysis Board-Editor) then click on the Copy FEN To Clipboard button & you can copy & paste the FEN string anywhere, such as a text-editor like Notepad.

That was the first thing I tried, prior to starting this thread in early March.  Prior to the 3/26/12 site update (and I didn't notice if it happened right away, A LOT of tweaks trickled in later) that feature was not offered.  Which didn't make a lot of sense, so it seemed like an obvious fix when they did the update. 

stephen_33
homernh wrote:
stephen_33 wrote:

Some great advice above but nobody's actually answered the OP's question: Once you've dragged all the pieces to their proper places on the board in Position Setup mode (Analysis Board-Editor) then click on the Copy FEN To Clipboard button & you can copy & paste the FEN string anywhere, such as a text-editor like Notepad.

That was the first thing I tried, prior to starting this thread in early March.  Prior to the 3/26/12 site update (and I didn't notice if it happened right away, A LOT of tweaks trickled in later) that feature was not offered.  Which didn't make a lot of sense, so it seemed like an obvious fix when they did the update. 

I didn't know that - explains everything !

wbport

The link in this related post takes a FEN string to convert it to a diagram using a font: http://www.chess.com/forum/view/general/creating-chess-diagrams

JCapanegra

Hi.... seems at last I could found people talking about fen!Smile

I need to make an string of fen´s using a game data base.

The only progrma I found to do it is pgn2fen..... but it seems to works wrongly :-(  Do not show me the position after the last move Frown

stephen_33

It's not very clear what exactly you want to do - could you explain in a little more detail please?

A FEN (string) is a string of printable characters, describing a specific board position but without any moves list; whereas you say you want to create a string of FENs - is that correct?

Lagomorph

I have always wanted to know the answer to this question....

How long is a FEN string ?

EscherehcsE
Lagomorph wrote:

I have always wanted to know the answer to this question....

How long is a FEN string ?

It depends on where the scissors cuts it.

(The technical but boring answer is that the length is variable.)

JCapanegra

Sorry to not be clear.

I need to do one fen line for initial position:

"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" (here is your answer lagomorph)
together with a second fen line of the position after white move1:
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1 (if whites did e4), 
and a 3rd line with the positin after black´s move 1; and a 4th with the position after white´s move 2; etc
till the position after last move.
wbport

The "e3" on your 3rd line shows where an en passent capture could happen (not possible here, of course).

JCapanegra

Yes wbport, I saw two differents ways to do it.

Just when the en passant capture could really be possible and even when is not possible, just after pawn advance 2 steps.... but do not implies differnces for my objetive.

stephen_33

You havn't made it clear why you want a set of FEN strings for a sequence of moves but do you understand that a PGN file is the usual way of recording an initial position with a sequence of moves?

One way of obtaining the FEN of a position is to write it yourself - not so difficult after a lot of practice. Alternatively, you can paste your starting FEN into Game Editor, make a move & copy the new position FEN string into a separate file. Then you can make another move & repeat the process...

If that's of any use, I can explain how to do it.

JCapanegra

Hi stephen_33

I want to make a kind of stats about how often are some relative positions between pieces, so I need to study thousends of positions and for this PGN are useless..... that is, I could deduce the position strting with PGN.... but this si exactly what fen, or epd are. And no way to do it maually one by one, I need to do, I say, thousend to read one, actualize my stats, read another one, actualize my stats, read another one.... and so on ;-)

stephen_33

Now I understand what you're trying to do!  I don't know of any existing software or commercial package that will do that for you but others may know of something.

Do you have any coding ability because it sounds like the kind of problem that could be solved if you have?

JCapanegra

pgn2fen it is suppoused its do.... but have a bug, do not show the position after the last move :-(

Mmm... just n QBasic.... I´m fighting with it but not making from scratch, using others than make epd files that are too much longer than fen´s.

EscherehcsE
JCapanegra wrote:

pgn2fen it is suppoused its do.... but have a bug, do not show the position after the last move :-(

Mmm... just n QBasic.... I´m fighting with it but not making from scratch, using others than make epd files that are too much longer than fen´s.

This thread might give you some ideas for solutions to your problem. The guy that started the thread wants to print an epd for only the last game positions in a PGN file.

Norm Pollock mentions that you should be able to use his epd tools to remove the comment at the end of your epd lines.

Also, Ferdinand Mosca created a tool to output the last position of every game in a pgn file both in fen and epd format.

http://talkchess.com/forum/viewtopic.php?t=55542&sid=45e94e9baf08ae35203c6648a895a56a

ipcress12

Use "pgn-extract --fencomments" to append the FEN string for each game position as a PGN comment to each move.

Download: http://www.cs.kent.ac.uk/people/staff/djb/pgn-extract/

I haven't tested this feature, but I have used pgn-extract to add Opening, Variation and ECO attributes to PGN listings and found it to be reliable.

JCapanegra

Going right now to our suggestions!

It seems I did it when some mistakes appears.... now names and surnames sometimes separated with commas and sometimes with "-" in PGN are runs me crazy cause commas use to separates strings and "-" not when to read data :-(