Chess changes: en passant and not suggesting illiegal moves
Tyson Williams
tyson.d.w at gmail.com
Mon Jun 8 11:04:17 BST 2020
No rush. I can wait for your normal release process. I don't need any
special treatment.
It might be possible to remove the later check for an illegal move.
https://invent.kde.org/education/gcompris/-/blob/master/src/activities/chess/chess.js#L151
Of course it would be safer to leave this code as is. The main advantage I
see with removing it is one less phrase to translate when localizing.
On Mon, Jun 8, 2020, 3:43 AM Johnny Jazeix <jazeix at gmail.com> wrote:
> Hi Tyson,
>
> no release scheduled yet for the next 3 months at least. We will do
> one once "multiple dataset" feature will be done for most of the
> activities.
>
> Depending on your OS, I can take a look to generate an executable/package.
>
> Johnny
>
> Le dim. 7 juin 2020 à 23:37, Tyson Williams <tyson.d.w at gmail.com> a écrit
> :
> >
> > Hello Johnny,
> >
> > That looks great. Thanks for making that change :)
> >
> > When should I expect that change to be released? Is there a specific
> version number for it?
> >
> > On Sun, Jun 7, 2020 at 4:17 PM Johnny Jazeix <jazeix at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I removed all impossible moves (should cover all images except the
> >> en-passant one):
> >>
> https://invent.kde.org/education/gcompris/-/commit/25679d605d832720447ea84066794e9283c3dd22
> .
> >>
> >> For the en-passant, as told before, it needs to be checked if it is
> >> already handled in the p4wn library that we use or not. If it is
> >> already implemented, we need to understand why it does not work in our
> >> code.
> >> If it is not, best would be to add it on the upstream library if they
> >> are opened to contributions and report it on our code.
> >>
> >> I'll create a new bug later for en-passant, so we can dissociate the 2
> issues.
> >>
> >> Johnny
> >>
> >> Le dim. 7 juin 2020 à 13:45, Tyson Williams <tyson.d.w at gmail.com> a
> écrit :
> >> >
> >> > Thanks Johnny,
> >> >
> >> > If the move suggestions are an easy fix for you, then by all means,
> go ahead. I will put it on my TODO list a well. My typical development
> environment includes C# or F#, Visual Studio, and Azure DevOps or GitHub,
> so the different environment will be a challenge, but I am willing to try.
> Your links into the code will be very helpful.
> >> >
> >> > On Sun, Jun 7, 2020, 5:20 AM Johnny Jazeix <jazeix at gmail.com> wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> I removed the images from your mail, created a bug on our tracker
> >> >> (https://phabricator.kde.org/T13248) and added the images in it
> >> >> https://phabricator.kde.org/M175.
> >> >> For the en-passant move, I probably won't have the knowledge to fix
> it quickly.
> >> >>
> >> >> For restraining the moves to the only "really" possible ones, it
> >> >> should be possible:
> >> >>
> https://invent.kde.org/education/gcompris/-/blob/master/src/activities/chess/chess.js#L317
> :
> >> >> we display the possible moves.
> >> >> Here is the function where we check if the move is legal or not:
> >> >>
> https://invent.kde.org/education/gcompris/-/blob/master/src/activities/chess/chess.js#L151
> >> >>
> >> >> I can add it in my todo list, except if you want to take a look.
> >> >>
> >> >> Johnny
> >> >>
> >> >> Le dim. 7 juin 2020 à 03:30, Tyson Williams <tyson.d.w at gmail.com> a
> écrit :
> >> >> >
> >> >> > Hello everyone,
> >> >> >
> >> >> > I decided to only take screenshots for the incorrect cases, of
> which there are five.
> >> >> >
> >> >> > The first is that en passant is not possible but should be. See
> attached file "en_passant.png".
> >> >> >
> >> >> > The other four cases are moves that are suggested but should NOT
> be. In all four cases, only the suggestions are wrong. Trying to play at
> any of these "bad" suggestions displays the error message "Invalid, your
> king may be in check".
> >> >> > 1. Suggested moves for the king should not include moving to a
> square that is under attack. In the attached file
> "1-King_moving_into_an_attack.png", there should be no suggested moves for
> the king.
> >> >> > 2. When in an absolute pin, there should be no move suggestions.
> In the attached file "2-Stuck_in_absolute_pin.png", there should be no
> suggested moves for the bishop. There are some other pin-related cases
> that are more complicated.
> >> >> > 3&4. When in check, the only valid moves of non-king pieces are to
> block or capture. In the attached file "3_Only_move_absolute_pin.png", the
> only suggested move should be to block the queen's attack. In the attached
> file "4-Only_move_capture.png", the only suggested move should be to
> capture the queen.
> >> >> >
> >> >> > The program already knows that some of the suggestions are no
> good. That is why it doesn't allow those moves and shows an error message
> instead. I just want it to never show those bad suggestions in the first
> place.
> >> >> >
> >> >> > On Fri, Jun 5, 2020 at 5:35 PM Tyson Williams <tyson.d.w at gmail.com>
> wrote:
> >> >> >>
> >> >> >> Hello Johnny,
> >> >> >>
> >> >> >> Thanks for the links. I will take a look at them.
> >> >> >>
> >> >> >> To help you and others better understand the cases, it just
> occurred to me that I could create and markup some screenshots. I should
> be able to get those over the weekend.
> >> >> >>
> >> >> >>
> >> >> >> On Fri, Jun 5, 2020, 2:48 PM Johnny Jazeix <jazeix at gmail.com>
> wrote:
> >> >> >>>
> >> >> >>> Hi Tyson,
> >> >> >>>
> >> >> >>> thank you for your explanation. We are using the engine of p4wn
> >> >> >>> (https://github.com/douglasbagnall/p4wn) to power the chess
> activity.
> >> >> >>> There were already a few bug they fixed for "en passant":
> >> >> >>>
> https://github.com/douglasbagnall/p4wn/issues?q=is%3Aissue+is%3Aclosed
> >> >> >>> but maybe that did not handle all the cases.
> >> >> >>>
> >> >> >>> If you have knowledge, for sure these improvements are welcome!
> >> >> >>> If you can reproduce the bugs in http://p4wn.sourceforge.net/,
> then it
> >> >> >>> would be better if this can be fixed upstream (proposing a pull
> >> >> >>> request) and we'll have to report on our code
> >> >> >>> (
> https://github.com/gcompris/GCompris-qt/blob/master/src/activities/chess/engine.js
> ).
> >> >> >>> I can help you understand the code on GCompris, but will have
> more
> >> >> >>> difficulty to help on the engine.
> >> >> >>>
> >> >> >>> I'll take a closer look tomorrow to try to understand more the
> >> >> >>> different use cases you are talking about.
> >> >> >>>
> >> >> >>> Johnny
> >> >> >>>
> >> >> >>> Le ven. 5 juin 2020 à 14:18, Tyson Williams <tyson.d.w at gmail.com>
> a écrit :
> >> >> >>> >
> >> >> >>> > !Hello everyone,
> >> >> >>> >
> >> >> >>> > My children (twin 6yos and 4yo) love playing the activities in
> GCompris. In particular, one of my 6yos especially enjoys that he can been
> me at the flying kings variant of checkers.
> >> >> >>> >
> >> >> >>> > Anyway, there are two improvements that I would like to make
> to the chess activities.
> >> >> >>> >
> >> >> >>> > The first is that en passant is not a supported move. I would
> like to add support for them.
> >> >> >>> >
> >> >> >>> > The second is about the inconsistency in which moves are
> displayed as possible. After clicking on a piece, the general behavior is
> that the squares to which that piece can move are highlighted. The
> suggested moves vary according to the situation in many cases.
> >> >> >>> >
> >> >> >>> > Here are five cases in which only legal moves are suggested:
> >> >> >>> > - Opponent pieces in the way (e.g. if R on a1 can capture at
> a2, then capturing at a3 is not suggested)
> >> >> >>> > - Own piece in the way (e.g. there are no suggested moves for
> the king as the first move of the game)
> >> >> >>> > - Pawn's first vs non-first move (i.e. only when it is a
> pawn's first move and the two squares in front of it are empty is the
> suggestion given to move the pawn forward two squares)
> >> >> >>> > - Pawn capture (i.e. only if an enemy piece is diagonally in
> front of a pawn is the suggestion given to move in that diagonal direction)
> >> >> >>> > - Castling (i.e. castling the king by moving it horizontally
> is only suggested if it is valid...which means the king has never moved,
> the rook as never moved, square the king moves through is not being
> attached, and the square the king stops on is not being attached)
> >> >> >>> >
> >> >> >>> > In contrast, there is one case in which invalid moves are
> suggested, which is when the king of that player would become under attack
> (except for castling as mentioned above). I know of four ways in which
> this can happen:
> >> >> >>> > - Suggestions are given to move the king to a square that is
> under attack.
> >> >> >>> > - Suggestions are given to move a piece that is absolutely
> pinned.
> >> >> >>> > - For a piece that can put itself into an absolute pin,
> suggestions are given to move that piece that would not place it into an
> absolute pin.
> >> >> >>> > - For a piece that can capture a piece attacking the king,
> suggests are given to move that piece that does not capture that piece or
> place it into an absolute pin.
> >> >> >>> >
> >> >> >>> > If the user clicks such an illegal suggestion, the follow
> message is displayed.
> >> >> >>> > > "Invalid, your king may be in check"
> >> >> >>> >
> >> >> >>> > This message makes me think that I have missed some
> case....that the game can suggest a move that is illegal for some reason
> other than the king being under attack after the move. However, I have
> been unable to find such a case.
> >> >> >>> >
> >> >> >>> > When my children play chess and their king becomes checked,
> they click the suggested moves to get out of check, but many of them are
> illegal and display that message to them. I would prefer if those illegal
> moves were not suggested.
> >> >> >>> >
> >> >> >>> > Would making en passant possible and removing illegal move
> suggestions be welcome changes to the chess activities?
> >> >> >>> >
> >> >> >>> > --
> >> >> >>> > Tyson Williams
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Tyson Williams
> >
> >
> >
> > --
> > Tyson Williams
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/gcompris-devel/attachments/20200608/80d89f8f/attachment.htm>
More information about the GCompris-devel
mailing list