Chess: some moves are possible where they should not be
Closed, ResolvedPublic

jjazeix created this task.Jun 7 2020, 10:07 AM
jjazeix updated the task description. (Show Details)
tysonwilliams reopened this task as Open.EditedSep 14 2020, 9:20 PM
tysonwilliams added a subscriber: tysonwilliams.

I just tested this using https://gcompris.net/download/qt/linux/beta/gcompris-qt-1.0-beta-Linux64.sh. The en passant behavior is better...because it is now at least possible...but its implementation is a bit buggy.

Steps to reproduce:

  1. White: E2 -> E4
  2. Black: A7 -> A6
  3. W: E4 -> E5
  4. B: F7 -> F5
  5. W: E5 -> F6 (This is the en passant move)

So far, everything is working correctly.

We are about to encounter a bug. I have found two different ways to experience it.

Case 1:

  1. Click on the black piece on E7 or G7 or G8
  2. Click on the white piece on F6 to capture it.

Case 1 expected behavior:
The white pawn on F6 is completely removed from the board, the black piece selected in step 6 moves to F6, and it is white's turn to move.

This screenshot is for the variant of step 6 that selects the black pawn on E7.

Case 1 actual behavior:
The white pawn on F6 only partially removed from the board. It is moved to one "square" below and to the left of A1. The black piece selected in step 6 does not change squares. It is still black's turn to move.

This screenshot is for the variant of step 6 that selects the black pawn on E7.

However, no black piece (or white piece) is selectable. Trying to click any black piece causes the text at the top of the screen to turn red and say "Invalid, your king may be in check".

Case 2:

  1. Click on any black piece not on E7, G7, or G8 (i.e. not any of the pieces from Case 1) that has a legal move
  2. Click on any one of the highlighted squares (which exist because this piece has a legal move)

Case 2 expected behavior:
The black piece selected in step 6 moves to the location selected in step 7, and then it is white's turn to move.

This screenshot is for the variant of step 6 that selects the black rook on A8.

Case 2 actual behavior:
The black piece selected in step 6 does not change squares. The text at the top of the screen still says it is "Black's turn". The black piece selected in step 6 is still selected, and its legal moves are still highlighted. Now, repeat step 7. The text at the of the screen becomes red and says "Invalid, your king may be in check".

This screenshot is for the variant of step 6 that selects the black rook on A8.

Workaround 1 (for both case 1 and case 2):

  1. Click the undo button
  2. Click the redo button

Workaround 2 (for both case 1 and case 2):
This is like workaround 1, but step two "manually" achieved.

  1. Click the undo button
  2. Repeat steps 6 and 7

In both workarounds, the behavior that results from step 2 is the same as both of the above expected behaviors.

jjazeix added a comment.EditedSep 15 2020, 7:00 AM

Hi,
thank you for testing this quickly!
Yes, please if you can provide screenshots on where the pieces are supposed to be, it would make us gain time, especially if we want to fix it for the release.

Yes, I would love for this fix to be in the release. I added screenshots to my previous comment. Please let me know if there is anything else I can do to make this easier for you to fix. I will continue to quickly test anything you would like.

I can reproduce and I see an error, thank you for the detailed explanation. Now I have to fix it ;). Once done, we will create a new version to test again!

jjazeix added a comment.EditedSep 19 2020, 3:32 PM

I think I did a fix for this issue (https://invent.kde.org/education/gcompris/-/commit/8906433fef70d412dfcf31b363b7455e89e6ec0d).

Are you able to compile GCompris or do you prefer we send you a new beta version to check?

Great!

I haven't compiled it before, but I am certainly willing to try. Is there a README with institutions I can follow?

Which OS are you using? If ubuntu:
sudo apt install qml-module-qtsensors qml-module-qtquick-particles2 qml-module-qtmultimedia libqt5sensors5-dev libssl-dev qttools5-dev libqt5xmlpatterns5-dev qtxmlpatterns5-dev-tools qtmultimedia5-dev libqt5multimediawidgets5 qtdeclarative5-dev build-essential libqt5svg5-dev cmake git qt5-default gettext

Then you need to clone the repository:
git clone https://invent.kde.org/education/gcompris.git

Then going into this folder and switching to the good code branch : cd gcompris && git checkout KDE/1.0
You need to create a build/ folder : mkdir build.

Then, we are going to compile the code :
cd build
cmake ..
make -j 4

To run it: ./bin/gcompris-qt

To update the code if we make new changes: git pull (and then you need to go to the step to compile the code)

Perfect instructions. Are they also in the repository? I highly recommend including this information in the repository. I checked a few files but didn't find anything like it, but maybe I missed them.

This now works great. No illegal moves are suggested and en passant is now possible. Good work! :)

They are in the wiki, I just didn't remember the link :)

Happy to hear it works fine now :)

Maybe here? However, I didn't find anything on that page that was anywhere close to the clarity of your instructions above.

Maybe here? However, I didn't find anything on that page that was anywhere close to the clarity of your instructions above.

Yes, this page. But it's more global than just ubuntu/debian, that's why it's more complicated.

I'll try to clean it up later and simplify it

jjazeix closed this task as Resolved.Oct 3 2020, 10:28 AM

Which OS are you using? If ubuntu:
...

I just installed Ubuntu 20.04 and followed your instructions again, but this time it didn't work. Do you know how fix this?

kids@desktop:~/GCompris/gcompris/build/bin$ ./gcompris-qt
exeCount set to:  1
QQmlApplicationEngine failed to load component
qrc:/gcompris/src/core/main.qml:23 module "QtQuick.Window" is not installed
qrc:/gcompris/src/core/main.qml:22 module "QtQuick.Controls" is not installed
qrc:/gcompris/src/core/main.qml:23 module "QtQuick.Window" is not installed
qrc:/gcompris/src/core/main.qml:22 module "QtQuick.Controls" is not installed

Found box2d in  "/home/kids/GCompris/gcompris/build/lib/qml"
Error: Your root item has to be a Window.

It misses some Qt packages, I think this command should fix it: sudo apt install qml-module-qtquick-controls qml-module-qtquick-window2

Perfect again. Thanks! :)