How do I enter a position for analysis in PicoChess?

117 views
Skip to first unread message

Aldo Bleeker

unread,
Nov 30, 2025, 8:13:27 PM (11 days ago) Nov 30
to PicoChess
Hi!

I'd like to analyse a position, but I can't find a way to import one in PicoChess. In other chess programs you can open or paste a FEN or PGN, or at least edit a board in a window. I have looked for an option to do this in PicoChess, but I haven't found it yet. There's the menu Position, but if I understand correctly, here you have to enter pieces on the board, and then scan the board. That's a great way if you have a board that supports piece recognition, put not so great if it doesn't.

I have 2 Millennium boards, the eOne and The King Competition with a ChessLink that I can connect via bluetooth or USB to PicoChess, and so far they've worked very well. But they both only offer move recognition, not piece recognition. I set up a position on the board, but scanning it only results in an illegal position. That figures, I guess PicoChess can see there are pieces on the board, but I think it has no way to see what exactly what pieces they are. Is it possible with my boards?

I've also tried menu option Game Setup > Read Game, and I've found out that it will read PGN files from Opt/PicoChess/Games. I've also discovered that PGN files support a FEN tag, so I've created one.

[Event "PicoChess game"]
[Site "?"]
[Date "2025.01.01"]
[Round "?"]
[White "Aldo Bleeker"]
[Black "Stockfish"]
[Result "0-1"]
[SetUp "1"]
[FEN "8/3P3k/n2K3p/2p3n1/1b4N1/2p1p1P1/8/3B4 w - - 0 0"]
[WhiteElo "500"]
[BlackElo "-"]


But when I read it in PicoChess, it just starts a game using the start position.
Is there anyone who has any pointers?

Thanks,

Aldo

Antonio

unread,
Dec 1, 2025, 2:14:21 AM (11 days ago) Dec 1
to PicoChess
Has probado la pestaña "Scan" ???    Pones la posición que quieres estudiar, seleccionas a quien le toca con los botones deslizantes y "Sync eboard".    Lo hice precisamente para eso, para que pulsando solamente 2 botones poder tanto jugar desde esa posición (yo lo uso para estudiar finales) como para jugar desde una posición deteminada.

Have you tried the "Scan" tab???    You enter the position you want to study, select who it is with the sliding buttons and "Sync eboard".    I made it precisely for that, so that by pressing only 2 buttons I can both play from that position (I use it to study finals) and play from a specific position.

Aldo Bleeker

unread,
Dec 1, 2025, 8:22:54 AM (11 days ago) Dec 1
to PicoChess
Hi Antonio,

I've tried the tab 'Scan', and I've noticed it functions quite like the menu option 'Position'. I've tried 'Scan' to see if that would work. I'm trying to set up this position.

chess.jpg

FEN: 8/3P3k/n2K3p/2p3n1/1b4N1/2p1p1P1/8/3B4 w - - 0 0

I've placed the pieces according to the diagram above on the board, a Millennium eOne with move recognition, but no piece recognition. White to move, no castling rights, not a 960 game, so I've switched off all options, and I've hit button 'SYNC BOARD'. This is the result.

sync.jpg

Note that there are pieces on d1, d7, and h7, but they're the wrong pieces, and most of the pieces are missing. This has happened because the eOne has submitted only the occupied fields that correspond with the starting position.

The problem is that the eOne doesn't have piece recognition, but only move recognition. When you set up a position on the board, it can tell PicoChess that a number of fields contain pieces, but it can't tell PicoChess what pieces occupy those fields, because it doesn't know that. It knows the position of pieces and what they are only because it tracks the moves of the pieces starting from the known normal chess starting position. To solve this you'd need a way to enter a position on the eOne, so it can submit it to PicoChess, but you can't do that from the eOne. Another way would be to import or paste a FEN. A PGN should be able to do it, because it can contain a FEN tag, but it looks like PicoChess doesn't recognise or use it, and seems to ignore it.

Aldo

Johan Sjöblom

unread,
Dec 1, 2025, 2:44:54 PM (10 days ago) Dec 1
to PicoChess
Hello.

I made a test branch that should be able to read a file with a FEN header. I will test it myself when I have time.
This means that: If you read a pgn file from the menu it should now load the correct position. It will always go into ANALYSIS mode if it has a FEN.

The branch name to pull is: 174-read-pgn-FEN

Johan Sjöblom

unread,
Dec 1, 2025, 2:54:04 PM (10 days ago) Dec 1
to PicoChess
Ah, it does not work.. I tested... Need to find out what is wrong. I am trying your example file.

Aldo Bleeker

unread,
Dec 1, 2025, 5:29:19 PM (10 days ago) Dec 1
to PicoChess
Thanks Johan, that's great! Looking forward to trying it!

I had a look at the PGN definition, and this PGN should be valid, but it isn't great. Looks like for an  export PGN there are 7 tags (STR, Seven Tag Roster) that should be present in this order: Event, Site, Date, Round, White, Black, Result. Then other tags, like FEN, may follow. If you want to use the FEN tag, you must first include a SetUp tag with value "1", and then the FEN tag.

So [WhiteElo] and [BlackElo] may be omitted. And it turns out that in this case [Result] isn't correct, 0-1 means black has won, but the game is ongoing, so it should have been *. This PGN should be an improvement.

[Event "PicoChess game"]
[Site "?"]
[Date "2025.12.01"]

[Round "?"]
[White "Aldo Bleeker"]
[Black "Stockfish"]
[Result "*"]
[SetUp "1"]
[FEN "8/3P3k/n2K3p/2p3n1/1b4N1/2p1p1P1/8/3B4 w - - 0 0"]

I've checked, and Lucas Chess and HIARCS accept it.

Aldo

Johan Sjöblom

unread,
Dec 2, 2025, 2:00:10 AM (10 days ago) Dec 2
to PicoChess
The FEN headers was not the big problem. But yes, the new chess library did not like the 0 0, it considered only 0 1 to be legal but I fixed that so now it tolerates also "0 0" at the end. I think both your original file and the new one will work now.

I designed it now so that if a FEN is present it will go into mode analysis automatically. I thought that makes most sense. Then you can start making moves for both sides and it keeps analysing. Of course you are free to switch the mode into playing mode if that is appropriate but first check the lever for playing side!
If you load a PGN game without a FEN, ie a "normal PGN game file", then it will be in playing mode if the game was not finished, but if the game was finished it will go into the new PGNREPLAY mode which allows you to start/stop autoplay using the pause-play button ||>

What gave me most headache was to get the analysis to show up immediately on the web client. So I fixed an old bug: If you now open the web client when you are in the middle of a game the web client will automatically jump into the latest position without waiting for the next move (issue 145). It now also tolerates the F5 refresh browser much better (without falling back to starting position when no move has been seen). So the biggest problem in this fix was that the web client only updates when it gets a new move and when we load a FEN we do not have any previous move.

You can also upload a pgn from your mobile phone by clicking the upload PGN button. It will do the same as reading a pgn from disc.

AND: there is a hidden feature: If you add a "PicoStop" header to any PGN game file... it will show the position at that halfmove !! So an alternative to having a FEN is to take a full PGN game file and add the header PicoStop, like for instance like this: [PicoStop "10"] ... It will then load the position after 10 halfmoves have been made so its very similar to the load FEN, but you will have the possibility to autoplay through the rest of the game.

To test you have to git pull the 174-read-pgn-FEN branch... Below is a more technical summary of what I have fixed.

-- Johan

Tech summary:
  • PGN loading now fully supports FEN headers: it builds the board from the PGN’s FEN, skips replay move stepping/pgn_game_to_step when FEN is present, routes all FEN games into analysis mode (Mode.PONDER in code), and keeps interaction mode in playing mode for unfinished/finished games and in Mode.PGNREPLAY for finished games
  • Missing analysis info fixed: best_sent_depth resets at PGN load start and after header display so early analysis shows immediately. (The best_sent_depth is a display and cpu priority mechanism)
  • Websocket clients now receive the last known board state on connect, and mid-game reloads (F5) keep the correct position and resume analysis display immediately.

Aldo Bleeker

unread,
Dec 2, 2025, 11:59:28 AM (10 days ago) Dec 2
to PicoChess
Thanks, Johan! Reading a game works great, PicoChess recognises the data in the PGN, and displays the position from the FEN. But it looks like the board isn't synchronised with PicoChess anymore, if you load a game when the board is in the start position, you can't use the board to make moves after loading the game, because the board is still using the start position. You can of course synchronise PicoChess with the board, but is there a way to synchronise the board with PicoChess?

Aldo

Johan Sjöblom

unread,
Dec 2, 2025, 12:56:20 PM (10 days ago) Dec 2
to PicoChess
Ah, ok I see. I have to test on my DGT board first. I would expect picochess to say "set pieces" and wait for me to get the DGT board exactly as the loaded position. But how to do that on ChessLink if Chesslink does not read the board position like DGT? 

This might be a strange idea, but what would happen if you switch off the ChessLink board and set up the position you see on your web client after loading a game, and then turn on the ChessLink board? I assume ChessLink would then send the moves?

Johan Sjöblom

unread,
Dec 2, 2025, 1:32:55 PM (10 days ago) Dec 2
to PicoChess
Learning learning... :-) It was not a good design of me to set Picochess in Analysis (Mode.PONDER) when I detect a FEN in the read PGN file. That interaction mode allows the eboard to "overwrite" with a new position. I updated the code now so that if we find a FEN I set the interaction mode to Eval.Score (Mode.KIBITZ). That makes it possible for me to set the board on the DGT without forcing a new position into Picochess.

Don't know if that helps with a ChessLink, but I will continue to test on my DGT eboard.

As usual, to get the new code you need to do a git pull. Very small change in the picochess.py file.

Johan Sjöblom

unread,
Dec 2, 2025, 2:07:24 PM (10 days ago) Dec 2
to PicoChess
Takeback of the first move does not work, it confuses the web client. But otherwise this new version works well with my DGT board.
The web client does not like an empty move stack. Takeback of the second move was not a problem.

gkalab

unread,
Dec 2, 2025, 3:47:06 PM (9 days ago) Dec 2
to PicoChess
Hi Aldo,

currently it cannot work with the eOne. The chesslink protocol, as it is implemented in PicoChess does not support it. It would need a special command to send the FEN position to the eOne. This command is not implemented.
The following functions would need to be coded:
* Detect if an eOne is connected.
* Send the special 'G' command with the FEN position to the eOne. Don't send this command for any other connected e-board supporting the ChessLink protocol.
* Implement the status command that is received in a different format for the eOne after the 'G' command was sent.

The eOne software is actually pretty good as it just acts is if it was an e-board that has full piece recognition. The caveat is that you need this special command if you want to start from any other position than the standard chess starting position.
This works really good for standard chess but I could not get chess960 to work with the standard mode of the eOne, when I added eOne support to my Android apps.
To support chess960 you would need to disable the 'chess rules' mode and change the eOne to a different mode where it reports only piece occupancy. But this is then a lot more work. Maybe parts of the Sentio (Certabo) implementation could be reused for this.

Gerhard

Aldo Bleeker

unread,
Dec 2, 2025, 5:28:18 PM (9 days ago) Dec 2
to PicoChess
Hi Gerhard,

Thanks for the information! I was wondering myself if this was possible. I've noticed that Lucas Chess can do this, when I paste a FEN or a PGN to menu option Create your own game, and enable the eOne, Lucas Chess seems to write the position to the board, because when I then start PicoChess and scan the board, it displays the position I've just entered in Lucas Chess. But then again, Lucas Chess is known to use the drivers written by Graham O'Neill, that presumably do support that eOne command. I noticed with these drivers that the eOne actually is treated differently from the other boards.

Aldo

Aldo Bleeker

unread,
Dec 2, 2025, 6:12:17 PM (9 days ago) Dec 2
to PicoChess
By the way, this isn't an issue with the Millennium The King Competition, because it's a chess computer as well as an eboard, it has an interface that allows you to enter a position. Then in PicoChess you can just scan in the position you've entered.

Johan Sjöblom

unread,
Dec 3, 2025, 1:19:45 AM (9 days ago) Dec 3
to PicoChess
I tested some more and the new server code in 174-read-pgn-FEN is fine now as it also fixes the issue of entering a web client in mid game. Takeback of the first move works fine on the server side.

The learning I made when testing the takeback of the first move in the case where we did not start from the starting position. The takeback actually works well for the first move on the server side, and you can do the same first move again, or an alternative move. When you make any move the web client wakes up again. The web client is just confused when it has an empty move stack. I think the correct solution here would be that the web client should remember the latest seen FEN at the point when the move stack is empty. If the web client ever gets back to an empty move stack and someone does a F5 refresh it should use that FEN and not the starting position. That could also help 365 games, but it would certainly help with situations where we start from a FEN, regardless if it came from an eboard scan or if we read a position from a file. But that will be another issue branch in the future. I am good with this 174 branch now, and it works well on the DGT board.

Reply all
Reply to author
Forward
0 new messages