Questions tagged [fen]

Forsyth–Edwards Notation (FEN) is a standard notation for describing a board position of a chess game. The purpose of FEN is to provide all the necessary information to restart a game from a particular position.

A FEN string defines a particular game position, all in one text line and using only the ASCII character set.

A text file with only FEN data records should have the file extension .fen.

One FEN string consists of six fields separated by a space character:

<FEN> ::=  <Piece Placement>
       ' ' <Side to move>
       ' ' <Castling ability>
       ' ' <En passant target square>
       ' ' <Halfmove clock>
       ' ' <Fullmove counter>

Further details:

  1. Chess programming
  2. Wikipedia
29 questions
12
votes
4 answers

Converting a PGN to a list of FEN strings in nodejs (chess notations)

I'm building a chess-related application using nodejs. I've been trying to use chess.js as much as I can but I think I've hit a roadblock in terms of functionality. Before extending that functionality, I wanted to make sure that there wasn't another…
user623990
5
votes
3 answers

Org mode: describe a chess position and automatically generate image of chessboard

I write articles on chess. I often need to describe a chess position, using a standard format named FEN, and would like it to be automatically converted to a png image, and when I export the org document as LaTeX or html the image to be inlined. I…
engineerX
  • 2,914
  • 2
  • 18
  • 18
3
votes
1 answer

How to analyze position score in Stockfish

I have a FEN position and I want to analyze which position is stronger. For example, I have this position rnbq1bnr/pp2k2N/8/2p1p2Q/4N3/8/PPPP1PPP/R1B1KB1R b KQ - 0 1 How to evaluate a position and get score value using Stockfish? (example, the…
Armen Stepanyan
  • 1,618
  • 13
  • 29
3
votes
1 answer

Is it possible to take a FEN aka forsyth-edward notation and flip it from black to play and win to white

Lets say we have a chess fen and the fen is a black to play and win problem. Many times chess puzzle websites want to avoid the confusion of having to keep indicating who's turn it is to move so they rather just put all the puzzles as white to play…
2
votes
1 answer

Python Chess Data (FEN) into Stockfish for Python

I am trying to use stockfish to evaluate a chess position using FEN notation all in Python. I am mainly using two libraries (pgnToFen I found on github here: https://github.com/SindreSvendby/pgnToFen and Stockfish the MIT licensed one here:…
1
vote
1 answer

Failed chess FEN creation

I'm creating a chess engine, and I've run into a problem with my FEN function. The "p" which stands for the black pawn is turned into a 24 in the b array. But only the first instance of "p" is recorded. I've done some amount of debugging, and I…
CODESTER
  • 33
  • 1
  • 5
1
vote
1 answer

How do i get the played move by comparing two different fens?

So I have two fens. One gotten before the move and one after. How can I get the played move by comparing these 2 fens to each other and returning the answer in uci or any other format. I am using the python-chess library so maybe there is a way to…
Fancy129
  • 49
  • 3
1
vote
0 answers

Is there a way to see blunders, mistakes, missed checkmates in Stockfish

I'm using Stockfish and when I analyze a game, stockfish only shows best moves and value of position. Is it possible to display blunders, mistakes and possible checkmates ? For example, I have this pgn position 1. e4 c5 2. Bc4 Nc6 3. Nf3 e6 4. O-O…
Armen Stepanyan
  • 1,618
  • 13
  • 29
1
vote
0 answers

Chess bot getting moves for black wrong

I am using stockfish as a move calculator, and a tensorflow-chessbot, to get a FEN, from a game. It is getting moves for the white correct, but for black it fails. I am looking into this code, and can't see, why it could do that. It gives the trash…
Raicha
  • 19
  • 1
  • 1
  • 5
1
vote
2 answers

Generate Chess Board Diagram from an array of positions in Python?

I have an array which corresponds to the positions of pieces on a chessboard, like so: ['em', 'bn', 'em', 'wr', 'em', 'wp', 'em', 'em'] ['br', 'em', 'bp', 'em', 'em', 'bn', 'wn', 'em'] ['em', 'em', 'bp', 'bp', 'bp', 'em', 'wp', 'bp'] ['bp', 'bp',…
chomprrr
  • 406
  • 4
  • 15
1
vote
2 answers

Create FEN string in Unity after reading Chess Board

I made a fully functional chess game in Unity using C#. Now i want to add AI, for the chess engine i went with Stockfish. I got the engine inside the game but it does nothing because it cant communicate with the board. To communicate i need to make…
1
vote
1 answer

How to get a string of the FEN position

After I do import chess board = chess.Board() how can I have a string with the FEN of the position? In other words, how can I extract from board the FEN of the position as a string, with the same output as if I…
3sm1r
  • 520
  • 4
  • 19
1
vote
2 answers

Loop doesn't reach end of stream

I am developing a program for analyzing chess problems - especially endgame problems - using the .exe version of the open-source chess-engine Stockfish 9. Here is the (very simplified) EndgameAnalyzer class: class EndgameAnalyzer { private…
Michael Haddad
  • 4,085
  • 7
  • 42
  • 82
0
votes
1 answer

FEN Loader to Position giving off numbers

So i tried to build a FEN loader that create a "Chess Board" in a array Square[8,8]. This is the code so far public static void LoadPositionFromFen(string fen) { var PieceTypeFromSymbol = new Dictionary() { …
GabrieleC0
  • 33
  • 6
0
votes
1 answer

Translating FEN strings to chess peices with dynamic chess board divs

Given a valid FEN string, I want to change the classes of certain board places to have the chess peice go in that spot. However, because it is too tedious to do myself, I am generating a chess board dynamically. I am also (currently) not worrying…
1
2