Opening books in V4?

116 views
Skip to first unread message

Johan Sjöblom

unread,
Jan 10, 2026, 1:33:44 PM (9 days ago) Jan 10
to PicoChess
We need some opinions and facts on what we can, and what we want to do with the opening books in V4. I have some ideas but Idont know enough about the obooksrv.

If we use the obooksrv and if I understand it correctly it will be based on a single compiled data file that includes all the opening books that was used to compile it.
If the web client wants to show all that data it needs to use the obooksrv (like V3)
In this case there is no choice we can give the user in the web client. The user already gets a compilation of all the books used in that one file. That sounds good, but requires significant work on every update of that file.

Then we have the opening books in the books folder. Those can be used by picochess to pick moves before the selected chess engine starts playing. This is set in the picochess.ini.

So the question is, what,  if anything ,  do we as a user want to change in the web client?
- the book used by the chess engine?
- see only a single book of choice?
- see the compiled collection of the obooksrv?
Other…




Antonio

unread,
Jan 11, 2026, 3:21:23 AM (8 days ago) Jan 11
to PicoChess
Hello Picochess friends.

I'm going to give my opinion after having dedicated many hours to the project and having been able to contribute my "grain of sand."
Picochess is a project that has been around for many years, many people have worked on it, and thanks to that, we can enjoy its legacy today.
It was designed to be used with the DGT board and clock of the same brand, and little by little, functionalities have been added, as well as support for different boards that have come onto the market. Gradually, features that didn't exist initially have also been added, and depending on the programmer (who may be right or wrong) and their chess experience, they believe these features can be helpful when learning during games. I think that's the ultimate purpose of Picochess, besides playing; otherwise, what would be the point of so many engines with different Elo ratings, etc.?

Always, or at least since I've been part of this project, we've tried as much as possible to maintain everything that was already there (for example, the DGT clock is still 100% functional). But there comes a point where, to move forward (always based on the programmer's idea), we have to modify what's there. Added to this is the fact that the programmer's idea, which they then implement, lacks any feedback or support, unless it's a personal request or an unfavorable one, as evidenced by the comments or requests for testing that go unanswered (but that's a separate issue). Let's not forget that this is a completely free project, where we altruistically dedicate many hours to fixing bugs, and which currently offers the same or more features than any other paid alternative, such as Mephisto's Phoenix, DGTPi, etc.

I think that being able to select a different opening book for each game as it's being played, as well as being able to add new books in the standard .bin format, is a considerable improvement. Not all Picochess users have or should have computer skills. Being able to download a standard .bin book and add it to the folder, with it being fully functional, is a significant step forward. If this means abandoning the "closed" book that was previously available and which, being non-standard, wasn't so easy to change, then it gets my vote.

Sorry for the long post, and I hope what I meant was clear after using Google Translate. All ideas are welcome, Picocheross!
antiguo.jpg
Captura de pantalla 2026-01-11 091928.png

Johan Sjöblom

unread,
Jan 11, 2026, 4:35:48 AM (8 days ago) Jan 11
to PicoChess
Hello all.
While waiting for more comments from brave testers of V4 I think I found a way to get both the old and the new at the same time !! 

If you now test the latest master branch there is a default "fake" opening book named "obooksrv". If you use that "special" opening book then it will use the obooksrv. And you are still free to use any opening book in the list in the books folder, including your own books that you have added. Just flip to another book using the arrows in the books tab. I have also added a memory for which book each web client has chosen.
I added information in the readme file.
Happy Testing and Playing!

-- Johan

Johan Sjöblom

unread,
Jan 11, 2026, 4:58:34 AM (8 days ago) Jan 11
to PicoChess
A technical network note for anyone who is interested. Compared to the pre-December-2025 version the communication with the obooksrv is now done completely on the backend side. This means that the only traffic from a web client to your picochess backend is on the chosen web port like 80, or 8080. It also means that we could tighten the security setup around the obooksrv if we want. Anyone who wants to tighten security can block port 7777, or actually block all ports except the web port 80 to the picochess server. The obooksrv can be used by other programs of course so don't block 7777 if that is the case.
This should make it easier for those who use a web client on a very remote location... You only have to make sure that the port 80 is open all the way.
-- Johan

Randy Reade

unread,
Jan 11, 2026, 5:43:25 AM (8 days ago) Jan 11
to pico...@googlegroups.com
I think there may be some confusion as to the purpose of the book tab in the web server. Or maybe I'm misunderstanding something. It's purpose was to show, as Gerhard stated, the most popular moves played by the top chess players based on the current position on the board and their outcomes (whether they led to a win, loss or draw). It has nothing to do with the moves that the engine will play in response to the user's moves. This is set by the selected book using the menu. The (menu) selected book ensures the engine responds with moves typical of the opening (book) selected (it's actually PicoChess just playing the book moves until the game reaches 'out-of-book' and then the selected engine takes over).
Perhaps the 'book' tab is a misnomer and could be labeled differently but, in my opinion, it should continue to show popular continuations and their historic outcomes as Gerhard's obooksrv provides.

Randy

RAP

unread,
Jan 11, 2026, 5:47:11 AM (8 days ago) Jan 11
to pico...@googlegroups.com
In my case it was a discovery. One day I saved up to buy a DGT dashboard with its DGTpi watch. It was looking for an update on the official page that led me to discover you. My intention was to update the watch to the latest version and I ended up buying the raspberry 5. When I saw that I published new images of picochess installation, I downloaded them and tested them on my raspberry. I don't have computer knowledge, nor am I a raspberry user, but one thing I do know is the affection I have for chess. I'm a zero on the left, but with picochess, it's helping me a lot to learn and improve my game. I'm very sorry I can't help improve since my knowledge is limited, very limited, but I have to say that the work is incredibly fantastic. Also to say that with a capturer my picochess saw it on a 10" tablet. Now I have changed it for a 16" portable monitor and I have to say that it looks very very good. Thank you. Lo siento, mi inglés también viene del Google! ;)

--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/e5d131ab-5012-4d0c-bbde-4eb0574e45a6n%40googlegroups.com.

Dirk

unread,
Jan 11, 2026, 5:57:17 AM (8 days ago) Jan 11
to pico...@googlegroups.com, pico...@googlegroups.com
I totally agree with Randy.

Am 11.01.2026 um 11:47 schrieb RAP <ebaris...@gmail.com>:



Johan Sjöblom

unread,
Jan 11, 2026, 6:33:09 AM (8 days ago) Jan 11
to pico...@googlegroups.com
Yes there was some confusion. That's why I started this discussion.

I think we now have a solution in master.

First of all: yes there is no change to how picochess plays opening moves,... just like you wrote Randy, it's the same as before, based on the picochess.ini file

The change is what a web client shows in the books tab.
Now the user can chose to see the obooksrv or a normal bin file in the web client. I think I managed to keep both options for the user with the change I made today.

-- Johan


 

Randy Reade

unread,
Jan 11, 2026, 7:04:41 AM (8 days ago) Jan 11
to pico...@googlegroups.com
Perhaps I don't understand the enhancement since I've been unable to look at the changes. Of course as long as we don't lose legacy functionality any progress is both encouraged and appreciated. What is the intent of 'seeing the normal bin file'? What do you mean? What is it providing? Sorry if this has been explained already.

Randy

Antonio

unread,
Jan 11, 2026, 7:30:50 AM (8 days ago) Jan 11
to PicoChess
Let's say I'm a bad chess player and I want to learn a specific opening. I use the opening book I want, for example, a French Opening .bin file that I've created or downloaded. It's useless to know the moves the elite players make if I'm not and never will be among the chess elite, but I can choose from the available alternatives in that position, depending on the opening I'm learning. .bin files are easy to download or create. There's plenty of documentation available.   That's the use I see for it and how easy it is to do. How many people know how to modify the obooksrv file?

Johan Sjöblom

unread,
Jan 11, 2026, 7:38:10 AM (8 days ago) Jan 11
to pico...@googlegroups.com
A user can, in addition to using oboooksrv as before, chose to look at any book file in the books folder (in the web client books tab). Its easier to see when you get the opportunity to test it.
No loss of legacy feature, as obooksrv can be chosen and is the default.
I guess the new feature is that you can easily add your favorite book.
And yes, the book file ending is "bin"

Randy Reade

unread,
Jan 11, 2026, 7:47:17 AM (8 days ago) Jan 11
to pico...@googlegroups.com
I'm not sure I see the benefit of playing moves just to stay within a predefined book rather than moves that are shown to lead to an advantage. Of course that would require updating the obooksrv database as new theory emerges but it's not too difficult to do as long as you have current data. Opening books require updating as well.

On Sun, Jan 11, 2026, 4:30 a.m. Antonio <antonio.z...@gmail.com> wrote:
Let's say I'm a bad chess player and I want to learn a specific opening. I use the opening book I want, for example, a French Opening .bin file that I've created or downloaded. It's useless to know the moves the elite players make if I'm not and never will be among the chess elite, but I can choose from the available alternatives in that position, depending on the opening I'm learning. .bin files are easy to download or create. There's plenty of documentation available.   That's the use I see for it and how easy it is to do. How many people know how to modify the obooksrv file?

--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.

Johan Sjöblom

unread,
Jan 11, 2026, 8:06:43 AM (8 days ago) Jan 11
to pico...@googlegroups.com
This is a very small feature. But we learned a lot of new things about the opening book handling and obooksrv and how to update them.

Next time when you test, have a look at the menu, engine and tutor tabs. I managed to show the internal picochess engine analysis in the engine tab and the tutor evaluations in the tutor tab. Now you can see analysis with or without starting a new extra web client Stockfish. This information does not consume any more CPU as it only shows the engine and tutor analysis info.

If you have extra cpu power and want to get tutor evaluations also for the retro engines moves, you can set coach-analysis to True in picochess.ini.
This is a very experimental setting, but now that we can see tutor evaluations in real time as we play, it could be interesting for someone to see the error done by retro engines.

gkalab

unread,
Jan 11, 2026, 9:49:50 AM (8 days ago) Jan 11
to PicoChess
Johan,

there is even an option to get rid of the obooksrv altogether: I did not know that the chess library includes polyglot reading but since the data file is binary compatible (just the fields are interpreted differently), it is easy to read the obooksrv format. See this example:

def _get_opening_explorer_moves(book_file: str, fen: str):
    moves_data = []
    try:
        board = chess.Board(fen)
        with chess.polyglot.open_reader(book_file) as reader:
            for entry in reader.find_all(board):
                move_uci = entry.move.uci()
                # reinterpret Polyglot fields
                weight = entry.weight  # uint16
                learn = entry.learn  # uint32
                whitewins = (weight >> 8) & 0xFF
                draws = weight & 0xFF
                n_games = learn
                blackwins = max(0, 100 - whitewins - draws)
                moves_data.append({
                    "move": move_uci,
                    "count": n_games,
                    "whitewins": whitewins,
                    "draws": draws,
                    "blackwins": blackwins,
                })
        moves_data.sort(key=lambda m: m["count"], reverse=True)
    except Exception as exc:  # pragma: no cover - defensive
        print(f"Error reading opening book '{book_file}': {exc}")
    return moves_data

Gerhard

Johan Sjöblom

unread,
Jan 11, 2026, 10:42:08 AM (8 days ago) Jan 11
to pico...@googlegroups.com
Oh wow. Another learning. Are you saying that I could basically move the obooksrv data file to books folder, and then put it as first index in the books.ini and we would have the same functionality as now? Same functionality, but just no obooksrv running?
Of course I would have to add some code, but that's details:-)
-- Johan

gkalab

unread,
Jan 11, 2026, 11:29:40 AM (8 days ago) Jan 11
to PicoChess
Yes exactly. No booksrv running, everything done in Python.

Gerhard

Johan Sjöblom

unread,
9:02 AM (14 minutes ago) 9:02 AM
to PicoChess
@gkalab when you have the possibility, have a look at https://github.com/JohanSjoblom/picochess/pull/249
I think this works nicely... but it would be good if you can verify.
My intention is that the file obooksrv/opening.data stays. Later I will turn it into a resource file that gets downloaded exactly to that position. Since I use git reset --hard when the picochess is updating I need to turn it into a resource file to allow users to create their own version of it... Thats why it later needs to move to a resource file. But that wont change the  behaviour and I will do that as a separate change.
-- Johan

Reply all
Reply to author
Forward
0 new messages