Website founded by
Milan Velimirović
in 2006

16:18 UTC
ISC 2022



Remember me

Forgot your
Click here!
to create your account if you don't already have one.

Rating lists


MatPlus.Net Forum General En passant and castling options in Popeye
You can only view this page!
(1) Posted by Andrew Buchanan [Wednesday, Oct 20, 2021 10:47]

En passant and castling options in Popeye


Of course I love Popeye deeply, and thanks to all who have worked on it, but one irritating quirk is the fiddliness with which en passant options must be expressed, natively and by implication in Olive - although the issue is a Popeye one. I won't bore you with details: if you've barked your shins on this while exploring designs you would know. However, the program is functionally correct, this is just an important UI issue.

Beyond the functionality which is there, I would like to add a Popeye option which is "en passant always works". Similarly, I suppose, it would be nice to have an option which is "castling never works". Most of the time, these broad brushes will allow one to get the desired behaviour with the minimum of fuss. One can always go deep with the existing detailed machinery later.

I have raised an issue in github, but I wanted to raise also a tempest of righteous enthusiasm here in MatPlus for these two new options.

Thanks again,
(Read Only)pid=21662
(2) Posted by Joost de Heer [Wednesday, Oct 20, 2021 18:42]

'Castling never works' can be done with 'nocastling e1e8'.
(Read Only)pid=21664
(3) Posted by Andrew Buchanan [Wednesday, Oct 20, 2021 19:09]

Hi thanks Joost, that really proves my point.

Nocastling is not as unforgiving as Enpassant, but still if I am translating the board and move pieces around, there can be problems. Suppose I start with (= 5+5 )
and set up nocastling e1e8 as you recommend. Suppose I then execute left-right flip, then move wK & bK back to their home squares directly without flipping. It's easy to do this kind of thing in the middle of design. I now have castling rights because the squares have been changed to d1d8.

So I would request to have simply nocastling without parameters mean "castling is by default not playable". If I do that now, I get all kinds of mad messages when I run Popeye.

Similarly for en passant: just ticking the box without parameters (something that currently drives Popeye into a frenzy) could be interpreted as meaning: "en passant is by default playable".
(Read Only)pid=21665
(4) Posted by Joost de Heer [Wednesday, Oct 20, 2021 19:22]

options work for all twins, so if you use 'option nocastling e1e8', in no twin can a king on e1 or e8 castle. Those squares don't 'translate' with a mirroring.

Compare the output of the following two inputs:

pie whi ke1 ra1 pa2
bla ke8
stip ~1
opt nocas e1e8
twin mirror a1<-->h1
move d1 e1

pie whi ke1 ra1 pa2
bla ke8
stip ~1
twin mirror a1<-->h1
move d1 e1

With the second file, for a) 000 is in the output and in b) 00. With the first, no castling is in the output for both a) and b).
(Read Only)pid=21666
(5) Posted by Andrew Buchanan [Wednesday, Oct 20, 2021 20:22]

Hi thanks for the response Joost. I'm sure it can be made to work for twins, but that's not my main use case. I'm talking about the fluid process of composing, when there's far too many things to think about, and I may want to definitively switch off castling, and know it will stay switched off, until I switch it on. Castling is not the worse of these, the real distraction comes from Popeye engine's interpretation of en passant.

I have to say I'm a bit surprised that you are continuing to take such a contrarian stance on this, Joost. You seem to be trying to defend something which is obviously far from convenient right now, yet very easy to make really robust. Please say already "great idea, Andrew - let's make sure it happens." I'm not always right, God knows, but I think I'm right on this :-)
(Read Only)pid=21667
(6) Posted by Joost de Heer [Wednesday, Oct 20, 2021 20:43]

I just don't see the difference between 'option forbidcastling' (or condition castlinglesschess) and 'option nocastling e1e8'. It's an option that should be turned on anyway, and there's a current option that turns it on, so I don't see the added value of another option.
(Read Only)pid=21668
(7) Posted by Andrew Buchanan [Thursday, Oct 21, 2021 02:52]

Thanks Joost,

The difference is the irrelevant square information. Olive does its best to keep track of these, but unavoidably it gets confused. As I showed, left-right flip followed by move of the pieces loses us "protection vs castling".

Maybe we are composing in different ways, and this is why you can't see my issue. If you are making long Popeye input files, then maybe you can track these options ok. But working dynamically with a single Olive board, e.p. specification is a big pain. Castling is less painful, but it's cleaner to provide abstractions for both rather than just for e.p.

For example, we may encounter SPRA, the version of PRA but which is optimistic on e.p. Popeye doesn't implement the protocols PRA & RS directly (except for mutex) but they are based on the two main conventions (castling & en passant). It's easy to reverse these two conventions simply, by providing flags to abstract beyond the mention of squares. This would be very helpful for forward problems with retro content, and is foundational for any future engine addressing the protocols directly.

Hope this helps.

Thanks again,
(Read Only)pid=21669
(8) Posted by Joost de Heer [Thursday, Oct 21, 2021 18:24]


As I showed, left-right flip followed by move of the pieces loses us "protection vs castling"

And as I showed, that's not a Popeye problem but an Olive problem. The feature you want is available in Popeye, but Olive apparently messes things up. So you want an option in Olive, not one in Popeye.
(Read Only)pid=21670
(9) Posted by Andrew Buchanan [Friday, Oct 22, 2021 04:01]

Thanks Joost,

If I wish to stop all castling, Popeye demands that I tell it where the kings are! Can't you see how Roger Irrelevant that is? It's quite comical. I can't believe you're insisting on this with a straight face, Joost :) And then blaming Olive!


Same deal but worse with en passant. I was curating a bunch of PDB e.p. problems last night. I can't count the number of times that Popeye threw angry text at me, and I had to go back and placate it by filling in or removing redundant or irrelevant data.

The castling & en passant conventions are only conventions. They should not be locked into Popeye. Each should be reversible with a simple boolean option. Poster child for this: SPRA. Maybe think of them as two fairy conditions: then conceptually there maybe less angst about offering them in the broad brush way I suggest?

It's great that Popeye offers very fine-tuned surgical instruments for particular fairy operations. But more people use kitchen knives than scalpels. Both have their uses.

All the best!
(Read Only)pid=21671
(10) Posted by James Malcom [Saturday, Oct 23, 2021 22:18]

A Popeye option for A Posteri would server well as well. :-)
(Read Only)pid=21679
(11) Posted by Geoff Foster [Sunday, Oct 24, 2021 11:28]

Many people want to change something about Popeye, but very few are willing to go through the proper channels to do so. The correct procedure is to raise a new issue through the website ( The issue should clearly explain what is wanted, with example problems where appropriate. The new issue can then be given a priority and processed when it comes to the top of the list. The Popeye programmers are a small team (of just one person?) who do a great deal of work for no pay. I am not associated in any way with Popeye, but I can sympathise with their plight. If you want the Popeye team to spend several hours on your request, then you must be willing to spend 10 minutes of your time to ask properly.
(Read Only)pid=21682
(12) Posted by Andrew Buchanan [Sunday, Oct 24, 2021 13:33]

Hi Geoff,

Hope you are well.

Not quite sure who you were addressing with your reply, but as I said in the base post I'd already raised an issue in github (as I have done in the past on other Popeye requests).

While I had followed the "correct" procedure, I felt it wasn't enough, because (a) if such a change is being mooted, other people might have some ideas different from mine (b) I felt my initial request was a bit vague, and dialogue might help.

And so it has proved! Although the interaction with Joost de Heer (who I dearly love) may have appeared a bit fractious, it was actually perfect from my perspective, as it allowed me to clarify my ask: a kitchen knife to supplement Popeye's existing scalpel. It also became clear that the best way to offer these may be as two independent fairy conditions that operate on otherwise orthodox problems only. I've now updated Github with a few paragraphs to specify exactly what I am asking for. This can hopefully save the Popeye team a lot of time, as they only need to read the dozen or so lines at the top.

I can include some examples, but feel that before I do, I should wait for a response from the Popeye team on what I've written already. I am not impatient here - I'm aware that it may take many months, and I have great respect for the team and what they've done over the years.

I have other ideas for Popeye for the future, and maybe might be able to apply to join the developers myself at some future point, but one thing at a time.

Thanks & all the best,
(Read Only)pid=21683
(13) Posted by Joost de Heer [Sunday, Oct 24, 2021 20:54]

I realised that 'nocastlingatall' and 'nocastling e1e8' are different:

(= 2+2 )

ser-002, anticirce

With 'nocastlingatall', there is (of course) no solution, with 'nocastling e1e8' there's one solution, with no nocastling option at all there's a cook in 1 move.

But I'm not sure that this is what Andrew had in mind.

For the orthodox case, I still think that Andrew is asking for an option that already exists, he just doesn't like the format of the current option. At best, it might be a GUI option in a shell around Popeye (e.g. Olive), but not an option in Popeye.
(Read Only)pid=21685
(14) Posted by Andrew Buchanan [Tuesday, Oct 26, 2021 03:33]

Thanks for this Joost. I think any further dialogue should probably be off-line. However, feel free to have the last word in this thread.
(Read Only)pid=21688

No more posts

MatPlus.Net Forum General En passant and castling options in Popeye