I'd like to hack out a new feature...

119 views
Skip to first unread message

Justin Blanchard

unread,
Mar 6, 2011, 3:37:27 PM3/6/11
to PyChess People
Hi!
I've been hacking away at PyChess this weekend; now I'd like to work
on something cooler than Yet Another UCI Patch.
I have a few ideas, but in each case I'm unsure how to do the UI.

* Endgame database support:
It's in the issue tracker. It sounds like a bad engine feature
(perfect late endgame play != fun ;) but in the GUI it could
complement the opening book sidepanel nicely. It could display all the
legal moves, whether they win/lose/draw, and (if the result is
decisive) how many moves it would take. This feature is feasible
thanks to Miguel Ballicora's Gaviota endgame tablebase library (MIT
license).
UI questions:
Can anyone think of a sane way to use the same panel for opening and
late endgame info? It's an attractive idea because the layout and
response to clicks will be so similar, and the panels will never both
be useful at once.
Will I have to worry about hiding this info for internet chess games?
(I don't use PyChess with FICS, so I don't know whether it turns off
any features to discourage cheating.)

* Annotation (PGN comment) support:
This seems like a logical sidepanel to add: it would look like the
current "comments" panel, but it would show the contents of PGN
comments (if any). Once that's working, it would also be neat to make
them editable. (I'm not sure whether I'd be able to code that; I don't
know much about GTK.)
UI questions:
Should the user get any special cue upon opening a PGN file with
comments? What about navigating to a position in the game where
there's a comment?
Should this be orthogonal to the existing comments panel?
When comments are editable, what's the UI for adding a comment to a
move? I'm thinking of having an extra comment box corresponding to the
current move number. If you scroll past a comment... the box
disappears when the comment gets highlighted. And then it reappears
below that comment in the list.

Best,
Justin

Tamás Bajusz

unread,
Mar 6, 2011, 5:00:21 PM3/6/11
to pychess...@googlegroups.com
Hi Justin!

You can find some initial work on annotated pgn support (based on chessmonk) in
the old database hg brach. Unfortunately I was too few to implement variation
support into pychess core classes, but feel free to use/enhance it any
way you like.

Tamás

> --
> You received this message because you are subscribed to the Google Groups "PyChess People" group.
> To post to this group, send email to pychess...@googlegroups.com.
> To unsubscribe from this group, send email to pychess-peopl...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pychess-people?hl=en.
>
>

Lobais

unread,
Mar 6, 2011, 5:30:12 PM3/6/11
to pychess...@googlegroups.com
On Sun, Mar 6, 2011 at 8:37 PM, Justin Blanchard
<uncombe...@gmail.com> wrote:
> Hi!
> I've been hacking away at PyChess this weekend; now I'd like to work
> on something cooler than Yet Another UCI Patch.

Sweet, I'll check out your work on the tracker.

> I have a few ideas, but in each case I'm unsure how to do the UI.
>
> * Endgame database support:
> It's in the issue tracker. It sounds like a bad engine feature
> (perfect late endgame play != fun ;) but in the GUI it could
> complement the opening book sidepanel nicely. It could display all the
> legal moves, whether they win/lose/draw, and (if the result is
> decisive) how many moves it would take. This feature is feasible
> thanks to Miguel Ballicora's Gaviota endgame tablebase library (MIT
> license).
> UI questions:
> Can anyone think of a sane way to use the same panel for opening and
> late endgame info? It's an attractive idea because the layout and
> response to clicks will be so similar, and the panels will never both
> be useful at once.

Actually I believe it is good to have some level of endgame table
support in the engine as well. The thing is that otherwise the engine
will play ridiculously bad. An engine that only thinks 5-6 moves ahead
isn't able to do anything, but move pieces in circles.
The key is afterwards implementing human like mistakes depending on
the skill level chosen.

But on the point, combining opening book and endgame table may be a
great idea. Currently the opening book panel is only wasting space,
once the first ten moves are played.
My idea would be changing it into a "Hint" panel. The hint panel would
draw moves from the book, from the hint engine, and from the endgame
table.
Hints from book or table, when available, would be shown before hints
from the engine, and marked or separated in some nice looking way.

> Will I have to worry about hiding this info for internet chess games?
> (I don't use PyChess with FICS, so I don't know whether it turns off
> any features to discourage cheating.)

We don't do any forcing of good moral.
I guess it is currently a bit too easy to cheat, but lets not worry
about it right now.

> * Annotation (PGN comment) support:
> This seems like a logical sidepanel to add: it would look like the
> current "comments" panel, but it would show the contents of PGN
> comments (if any). Once that's working, it would also be neat to make
> them editable. (I'm not sure whether I'd be able to code that; I don't
> know much about GTK.)
> UI questions:
> Should the user get any special cue upon opening a PGN file with
> comments? What about navigating to a position in the game where
> there's a comment?
> Should this be orthogonal to the existing comments panel?
> When comments are editable, what's the UI for adding a comment to a
> move? I'm thinking of having an extra comment box corresponding to the
> current move number. If you scroll past a comment... the box
> disappears when the comment gets highlighted. And then it reappears
> below that comment in the list.

I like mixing manual commenting into the comments panel. The fewer
panels the better.
The way I imagine it, would be having a comment box for every move.
Initially the moves are auto commented, or commented from a loaded pgn.
Double clicking them, or clicking a small edit icon, will let you
change the text.
Text entered by a human has another, more visible, color that the one
used by auto commenting.

However, to really use PyChess as a pgn viewer, we'd need support for
a game "tree", rather than just a list as we have now.
This is probably a bit more into the future, but perhaps Tamas has
some progress in the area.


Great to have you hacking,
Thomas Dybdahl Ahle

Justin Blanchard

unread,
Mar 8, 2011, 7:56:39 AM3/8/11
to pychess...@googlegroups.com
OK, I've decided the "hint panel" direction sounds more fun.
I'd generally like to improve opening and endgame knowledge.

I've started with the opening: my PyChess branch uses the Polyglot book
format. This has some advantages: It can drop the sqlite dependency. It
can drop the book creation code, because Polyglot and SCID work better
and are also free software. It can use more complete books by other
authors -- for instance, SCID's books are 3-22 times as large.
(Those are copyrighted by their owners, but they would probably grant
permission to use them.)
I converted the old book using a utility (added in df508a112b, deleted
in cd1ba55c0c).

There's one problem: Polyglot books don't contain win/draw/loss data for
each move. They do have optional learning data; as a hack, I used that
to store the old W/D/L data from the old book. So my branch still
displays the bars and tooltips, but that won't work with other book
files.

I think it would be OK to replace these statistics with a percentage
(how often the computer would play each move). If the weight is very
small, maybe we can show the move in red (to mark it as a blunder). The
bars looked neat, but I don't think they were that useful -- the book
was built from too few games for the statistics to be meaningful. Any
thoughts?

Because this is a learning experience for me (in Python and DVCS) I'm
confining the damage to a clone of the repo. :)
I gave it a bad name because I didn't realize what I was doing. Anyway,
it's at http://code.google.com/r/uncombedcoconut-hints/ on the
openings-endgames branch.

One more thing: if I'm supposed to be updating the stuff under doc/ when
I change lib/, I'd like a pointer on how to do that. :)

Lobais

unread,
Mar 8, 2011, 8:24:28 AM3/8/11
to pychess...@googlegroups.com
On Tue, Mar 8, 2011 at 12:56 PM, Justin Blanchard
<uncombe...@gmail.com> wrote:
> OK, I've decided the "hint panel" direction sounds more fun.
> I'd generally like to improve opening and endgame knowledge.

Sounds great.
I don't know enough about hg to tell whether an hg clone is overkill.
Since you should (hopefully) only need to change stuff in the
sidepanels/ folder, perhaps a branch would have some advantages.
Tamás?

> I've started with the opening: my PyChess branch uses the Polyglot book
> format.

> ...


> There's one problem: Polyglot books don't contain win/draw/loss data for
> each move.

Polyglot sounds great. That should hopefully make it easier for people
to supply and test their own opening books.
A win percentage could be an acceptable replacement for win/draw/loss.
Especially if it is drawn with a bit of bling ;)
Generally we want to include all the data we have about all three hint
types. Just see what you can collect.

> One more thing: if I'm supposed to be updating the stuff under doc/ when
> I change lib/, I'd like a pointer on how to do that. :)

I'm afraid that doc/ hasn't been updated for a long time.
Most of it is auto generated by pydoc.

As a rule I'd say, that every time you encounter something strange,
and eventually figure it out, add a comment or docstring in the code.
(Docstrings are the python way to do automatical documentation of
methods. It looks like this:
def square (x):
""" Given x the function returns x^2 """
return x*x)

Tell us how it goes,
Thomas

Justin Blanchard

unread,
Mar 11, 2011, 1:36:14 AM3/11/11
to pychess...@googlegroups.com
Hi!

I've redone the "bling" in the opening book panel.
http://i.imgur.com/mOpn0.png
The ? marks mean "blunder"; a move is considered bad if the book says
"play this 0% of the time".
If the book has performance history: The bars show it. Total length is
proportional to the # of games. Tooltips say:
White scores <b>61.4%</b> - <b>38.6%</b>
Based on 850 games

My next feature (endgame tablebase support) is ready for a demo.
I've implemented both Gaviota EGTB support and endgame info in the
sidepanel: http://i.imgur.com/uIJUr.png

I've made Gaviota TBs optional by design: the data files get big (e.g.
27 MiB for 4-man TBs), on Linux distros the library isn't packaged (yet,
AFAIK), and on Windows no one's yet built it as a shared lib / DLL.

This seems like a good time to discuss which ideas are good and worthy
of landing (post 0.10 of course), and which ideas suck. Does my
side-panel UI make sense for the opening and endgame phases? Is this
really the best way to handle opening books without limiting users to
The PyChess Book?

OK, only read past this point if you want to know more about the
specifics of my work so far. :)

I've added the conf keys (no UI yet) allowRemoteProbes and
GaviotaTbPath. The latter defaults to the system data dir.

If you want to test Gaviota TBs, it's not yet simple.
You must first get the library's source and TB files (See
http://sites.google.com/site/gaviotachessengine/Home/endgame-tablebases-1 : get the git or 0.3.2.3 version of the probing code), install libgtb.so.1.0.1 system-wide or in the data dir as libgtb.so.1 (its SONAME), and put the TB files in the data dir.

By default the current code tries to read Gaviota TBs and falls back to
k4it.de. You can tell what it's using because of a serious bug (which I
plan to fix): TB probing is a synchronous operation. Using k4it, you
have to wait for the sidepanel to load a web page before PyChess can
display a move.

Once I fix the blocking issue, I want to add detailed middlegame
analysis: I'll look into enabling MultiPV mode in engines.

Everything shows up in the Opening Book panel, which will of course be
renamed and refactored once I have things right in the specific game
phases. The hint panel should get its own preferences for the EGTB
folders, whether it should access the web, and how many variations to
analyze in middlegame positions.

I've written the EGTB providers as instance classes and the EndgameTable
class used by the sidepanel and the engine as a singleton. This was
accidental; I'm not sure of the best approach in python. Can I "iterate
over modules" to call global functions?

If all this goes well, I'd like input on how to make the engine behave.
IIRC it currently has strong opening knowledge at all difficulty levels,
and can potentially use EGTBs to improve both strong and weak play. (If
you can tell instantly that a move wins against most responses but loses
to the strongest move... that must be good for something!)

Lobais

unread,
Mar 11, 2011, 7:11:37 AM3/11/11
to pychess...@googlegroups.com
Hi Justin,
I've made a mockup how one could make a similar feel for endgames,
openings and hints.
More MultiPV support in the API would be great. At some point we'll
probably have to port the PyChess engin to UCI just to get this
feature out of the box.

I like your idea of falling back on online tables. While they are
loading, we should display a throbber.

Also, I'm all for creating a weak-player opening book, that the engine
will use on low levels.
It could contain openings such as a4, Ra3, h4, Rh3 :D
Perhaps it would even willingly go into a fools mate some percentage
of the time.

Does the book have any "play 0% of the time" moves?
Putting ? and ?? drawn and lossing moves in the egtb sounds good.

Again, if we can combine it all with a database of openings and
endgames, to provide background knowledge in tooltips, it could be
great.

Thomas

> --
> You received this message because you are subscribed to the Google Groups "PyChess People" group.
> To post to this group, send email to pychess...@googlegroups.com.
> To unsubscribe from this group, send email to pychess-peopl...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pychess-people?hl=en.
>
>

--
Mvh. Thomas

hintpanel.svg

Tamás Bajusz

unread,
Apr 7, 2012, 5:50:39 AM4/7/12
to pychess...@googlegroups.com
I'v just wrote a comment on issue #413, Adding a good analyse mode,
but I think it's better to repeat it here too:

I like to revitalize Justin's work on a modernized Hints panel,
so created a new gbtami-openings-endgames clone
(http://code.google.com/p/pychess/source/clones).

First I merged hes opening-endgames branch to tip.
Then I added ECO and opening name support.
Where we need to enhance it? Can anyone try and comment it, please?


2011/3/11 Lobais <lob...@gmail.com>:

gbt...@gmail.com

unread,
Apr 20, 2012, 5:00:18 AM4/20/12
to PyChess People
The work on hint panel continues in the main repo from now on.

gbt...@gmail.com

unread,
Apr 30, 2012, 5:58:33 AM4/30/12
to PyChess People
Today I reread this thread again and started to think about hint panel
and cheating.
Maybe the correct behavior should be enabling hints on finished moves
and observed games only.
What do you think?

Nikos Panagogiannopoulos

unread,
Oct 9, 2018, 3:36:38 AM10/9/18
to PyChess People
Hi all!

is there a way so far to show the ECO notations at the comments? Thanks in advance

Tamás Bajusz

unread,
Oct 9, 2018, 4:34:20 AM10/9/18
to PyChess People
ECO and opening name is shown in annotation panel header. Isn't it there for you?
Btw what version of PyChess are you using?

nikos panagogiannopoulos

unread,
Oct 9, 2018, 11:06:39 PM10/9/18
to pychess...@googlegroups.com
Morphy 0.99.3, i only see the moves there.. 

--
You received this message because you are subscribed to a topic in the Google Groups "PyChess People" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pychess-people/uZPTBAomx4w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pychess-peopl...@googlegroups.com.

To post to this group, send email to pychess...@googlegroups.com.


--

end of message. Try talk in cyph. My public key:
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2
 
hQIMA71qctUpO3NrAQ/8DuevWM3pm9R7FID+EnyB3E705NbParEbYxkdO6O60pky
9qvl8LWp5Vr83MZG46h172e9UyFbF5V4e+CamboV/rmvqrREgcECYL5LrEkZzox4
STgzTOD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/4pse1wLXbCqo5+SYKoEm3m
tw+9B1FCGyTUj174EHVYYZUH0I//61SBO1gQf3AG+VT7wvFM/oreQ89kSfz1tgp+
SqYPH4bMokG4Nhn0iVkQEdrbIC0tF3H1YRxzAL+6khtKCOL9WK468JZ8814fC93S
RSBAPnYo4elOOmLpuyBTC00MTEWp1f+Lk8PFiIUm6/RiC3pjUlTZsN9RzAXFZzbj
Ukfu01Xeiwa5GzyXxAm+oo/jNibB6gsZb6jVRg44iqwwNhcKX6K3dWRk5wGWGsOF
WczvOcYn2JRCAuSQI2CyJxk/ZsPaxnstUl8E/67gGnAHubjmWACUT0ziWCU1SMdG
8+nfroIA09RaW/fg1wc0NSUx3VYBaLMY9sOyW+IkQHe2XI3GURBZkyHBjqWyrwL6
kJPUStzYpnXw+Xic7PoPond1fBwWIFz5oHpfVdO5NZ3OV0817TqZ83TduH3c35i0
W77S8dGTc7xdiU4oJo4GEsBoqrI/+OrwVnogcZ4/u2fzvlozFLOZLFDbBzfnz+Tj
MoAGsEGoUX5KcE87cPx5JPnb7ScloXhcsBqDZYgWEAnaNECqiMaKUXtOJUcVQLjc
p6a8fIMIm1gu/CCi2+oeatdy96RjyqasoP6Qvs8sx/D5+mcdEG/aJWIMb9sEET5Q
81Wt71qkAIseYS5eI7uaZKn0qUb1i7wD3gUCJk2wwgS87ApTg1fS6J1VK0ko8YkX
Ft+4eat+9fdbiom0mH44Ir8c0TeSEg09q3yDNd3Gl806i/juQr3pwVKc4Rvtz6k5
oBKtQmjUWm7NLWkgJwLDx7r/CTYBiFPYu0BGU9UtSizdUzbKmLW4PGaWYeat2mnz
6zpob/ilBH1slNAFOkMnOJ420u4w9/Quls+yyWoBs3QRFaug8OYFLSg5lJcFuYTw
U/N2vBhuGOKO9Y+Itq7OXPum0TOV22GQ
=+aBo
-----END PGP MESSAGE-----

Tamás Bajusz

unread,
Oct 10, 2018, 4:08:25 PM10/10/18
to PyChess People
What OS are you using?
To unsubscribe from this group and all its topics, send an email to pychess-people+unsubscribe@googlegroups.com.
To post to this group, send email to pychess-people@googlegroups.com.

nikos panagogiannopoulos

unread,
Nov 4, 2018, 9:49:06 PM11/4/18
to pychess...@googlegroups.com
ununtu-studio

To unsubscribe from this group and all its topics, send an email to pychess-peopl...@googlegroups.com.
To post to this group, send email to pychess...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "PyChess People" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pychess-people/uZPTBAomx4w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pychess-peopl...@googlegroups.com.
To post to this group, send email to pychess...@googlegroups.com.

nikos panagogiannopoulos

unread,
Nov 4, 2018, 9:49:31 PM11/4/18
to pychess...@googlegroups.com
ubuntu-studio*

Tamás Bajusz

unread,
Nov 5, 2018, 7:43:57 AM11/5/18
to PyChess People
Continue there, please!


Reply all
Reply to author
Forward
0 new messages