Hot answers tagged

15

As thb pointed out, you need vectors. I suggest you use a python-chess to generate SVG vector images. Prerequisites: Python 2.6+ or 3.3+ Python-chess: Install form pypi using pip: pip install python-chess[uci,gaviota] Creating a script Since you might need to generate multiple SVGs, let's create a script. So, you can use the script to generate multiple ...


11

Yes there are easy ways to do this. I'm going to briefly show you one quick way of doing it in python, using the python-chess module. If the in-code comments are not enough, feel free to ask for clarifications or possible extensions of the code: To showcase a working example, I've taken a game between Adams and Kasparov, you can download the PGN from the ...


9

You may want to record a fragment of a real game starting from move number 24, for example. Then you specify the FEN after the first 23 moves and set the full move number to 24.


7

I am looking for a software or web site, which allows me to place the pieces on the board, and then create FEN notation automatically. I personally use this site for that. It is free, and it is an online tool. REMARKS: If you wish to put that FEN in our diagram you paste that code like this: Press space bar 4 times; Type square brackets ( [] ); Type fen ...


7

The FEN consists of six parts (see definition of FEN here): piece placement: at most 64 characters, one for each square plus 7 times "/" to delimit ranks = 71 characters active color: one character ("w" or "b") castling: at most 4 characters en passant: one or two characters half move clock full move number In addition there are 5 space characters between ...


6

Chess is a game in two dimensions. The game is made to be played in two dimensions. Pieces move horizontally, vertically, and diagonally very naturally on a chess board. It's purely visual and the sort of thing our brain does very well. Other depictions of the position sacrifice the two dimensional nature of the game. When this information is lost, we have ...


6

Since you're talking about programming, you're presumably looking for a storage scheme more compact in computer memory space than FEN. Besides going out to research how it's done in large tablebases, two possibilities come to my mind immediately. Normal FEN For the sake of this discussion, "normal" FEN is just a typical text string represented with 1-byte (...


5

I wrote a program that can recognize positions from books and magazines and give you the FEN. Here is the web interface for Chessputzer You can upload the image or paste directly from the clipboard. Note: it is designed for the the most common fonts used in print. It won't work for images from Chessbase etc. For that, use Fenbot. My aim was to make ...


5

For the others, there is a simple function in Stockfish engine, that validates a FEN String. bool Position::is_valid_fen(const std::string &fen) { std::istringstream iss(fen); std::string board, side, castleRights, ep; if (!iss) return false; iss >> board; if (!iss) return false; iss >> side; if (!iss) { ...


5

Let's start at the beginning To understand X-FEN for castling in Chess960, it helps if you first understand castling in Chess960. Castling rules are slightly different in Chess960, hence there comes a need for X-FEN. I believe it's the major source for your confusion. Minor Note 1 X-FEN is used not just for Chess960 but for many other variants as well (...


5

http://gorgonian.weebly.com/pgn.html http://exeterchessclub.org.uk/downloads (in chessbase format) Exeter has many other valuable resources.


5

This will do it. https://chessvision.ai. There is also the Chessify app on the ios store where you can take pictures of chessboards and import the position.


5

Using the definition of FEN it is relatively straightforward to compute an upper bound: piece placement: 64 (pieces/squares) + 7 (slashes) color: 1 (w/b) castling: 4 (KQkq) en passant: 2 (e3) halfmove clock: 3 (100) fullmove number: 4 (considering that maximum game length < 9999 due to the 50-move rule) spaces between fields: 5 So in total we get as an ...


4

If all the pieces are on the board, there are 64!/32!/8!^2/2^6*(32/63)*(31/61) or about 1.2*10^42 positions. This would require 140 bits. The 64!/32! puts the pieces on squares, the divisions account for permuting like pieces, and the last two fractions put the bishop pairs on opposite color squares. I would guess a dozen or so more bits would be required ...


4

Coming to the party late. Firstly I do not think it’s possible to validate 100% that a position is legal as the questioners asks. There are tens of thousands of retroanalytic problems which dance creatively on the border of legality and some of the reasons why a position is illegal are extremely subtle. I believe that the problem of legality is likely to be ...


4

Here is a simple backtracking algorithm, provided that you have a function that can check reverse legal moves at every board state (also known as position): function is_legal_state(state,move) //Terminate if a starting state was found. This immediately implies there //was a legal game that generated this state, in fact the backtracking //can tell ...


4

My solution has been to use a chess font like Chess Merida or Chess Cases. With such a font for example the start position is written like this: 1222222223 4tMvWlVmT5 4OoOoOoOo5 4 + + + +5 4+ + + + 5 4 + + + +5 4+ + + + 5 4pPpPpPpP5 4RnBqKbNr5 7888888889 And (assuming the line-height is set to the height of the font) it looks like this (Here using Chess ...


4

This website has a chess ebook reader available for scanning chess diagrams from PDF: https://chessvision.ai/ Additionally they also have browser extensions for Chrome and Firefox which is really handy in scanning images of positions on any web page.


4

A vector format would suit. As you may know, a vector format represents graphic not as a bitmap but geometrically, as a mathematical description which can be rendered at any scale. For web display, you can use the SVG format. Here are some chessmen in the SVG format. (If you follow the link, for each chessman, click through to "original file (SVG file)." ...


4

Chessfimee can perfectly serve you. It scans and analyses chessboards with chess diagrams, puzzles. All you need is to use the camera to take a photo of a chess diagram from books, papers, even LCD screens (PDFs, other sources). Also you can share the chess position (FEN) with other chess applications. An iOS version will be coming soon.


4

https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation "FEN does not represent sufficient information to decide whether a draw by threefold repetition may be legally claimed or a draw offer may be accepted; for that, a different format such as Extended Position Description is needed." QED.


4

One rule that depends on the move count is the time control. If you have a time control of 40/120, you need to know which move it is to know when the players get more time.


4

https://www.ocf.berkeley.edu/~abhishek/putz/ Lost two piece from scan http://www.chessgrabber.nicolaas.net/ Lost one piece, added one piece, and replaced two pieces. https://play.google.com/store/apps/details?id=com.fimetech.chessfimee Claims to be 98% accurate.


4

A file that contains one FEN per line is a file format in itself. It's the file format used by test positions for chess engines. So engines definitely have some process to analyse all the positions in a FEN file. (Ermm... your FEN is missing the king-castling, move number and who is to move indicator -- you'll want those.) An alternative would be to convert ...


4

From reading various chess source codes, mostly before 2005, I can state that most don't a FEN output. Any that would allow for a non-starting position should accept FEN, as it's just a special form of PGN. Crafty and san_kit both have a "fen" command.


3

Try the following. You upload the image, it scans and generates FEN. I don't know if it will read a pdf but converting a pdf to a common graphic format is not hard. Chess Grabber I tried it using the diagram from this posting. It generated its determination of the diagram and this FEN: rn1qk1nr/Pp4P1/2p2P2/4P2p/1bp5/2NbPPP1/PP2N1BP/B1BQ1RK1 w kq - 0 1


3

There is nothing in the FEN specification saying that the represented position must be reachable from the initial array. Proving that a given position is reachable from the initial array is an unsolved problem. In a valid FEN string, the half move count must be in agreement with the en passant target square; if a target square is present, then the half ...


3

SCID will do it. Create a position using Edit->Setup Board. There's a text box at the bottom of the setup window with the FEN. Or, if you've been playing against the computer, you can just say Edit->Copy FEN to get the board's current position.


3

Although one may try to place the first row as the eighth, the second row as the seventh, etc., the board will appear flipped (as shown above). This is a horizontal flip (mirror-image over the x-axis) and does not look quite right. Switching the letters from lower-case to capital and vice-versa would switch the colors, but that's not the best solution. ...


Only top voted, non community-wiki answers of a minimum length are eligible