Bug 302140 - Forty & Eight solver makes an illegal move.
Summary: Forty & Eight solver makes an illegal move.
Status: RESOLVED FIXED
Alias: None
Product: kpat
Classification: Applications
Component: solver (show other bugs)
Version: 3.6
Platform: Ubuntu Linux
: NOR major
Target Milestone: ---
Assignee: Ian Wadham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-18 18:11 UTC by Ramon
Modified: 2020-07-24 21:58 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Solver suggest broken move in this game (4.76 KB, application/octet-stream)
2012-06-18 18:13 UTC, Ramon
Details
broken game forty eight 1028370245 (4.77 KB, application/vnd.kde.kpatience.savedstate)
2013-05-18 17:04 UTC, mahlzahn
Details
broken solver (1.75 MB, video/ogg)
2016-10-04 19:16 UTC, kavol
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ramon 2012-06-18 18:11:24 UTC
The solver suggests an illegal move and also performs it when clicking demo. The move is impossible to do as user. As a bonus, without that move the game is not winnable, but with the move it is winnable.

Reproducible: Always

Steps to Reproduce:
1. Load the attached game
2. Press Demo

Actual Results:  
The solver moves Q (and K) beneath and K. 

Expected Results:  
Not making an illegal move. I'm not allowed to make the move, so neither should the solver.
Comment 1 Ramon 2012-06-18 18:13:04 UTC
Created attachment 71918 [details]
Solver suggest broken move in this game
Comment 2 Parker Coates 2012-11-09 13:49:05 UTC
Confirmed. In a debug build it actually causes an assertion with the following backtrace. No idea why it suggests such a move, though.

Thread 1 (Thread 0x7f871da19780 (LWP 18555)):
[KCrash Handler]
#5  0x00007f8725503425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007f8725506b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x00007f8726ba84c2 in qt_message_output(QtMsgType, char const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f8726ba8838 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f8726ba89c4 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#10 0x000000000041f212 in DealerScene::demo (this=0x41a4c20) at /home/coates/kde-devel/src/kpat/dealer.cpp:1645
#11 0x00000000004351dd in MainWindow::qt_metacall (this=0x2466f70, _c=QMetaObject::InvokeMetaMethod, _id=18, _a=0x7fffbb278180) at /home/coates/kde-devel/build/kpat/mainwindow.moc:141
#12 0x00007f8726cc5123 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007f8726050a32 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007f8726050c20 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007f872641551f in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007f87264157cc in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007f87264cf99a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007f87260a6850 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007f8726056e9c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007f872605bb6b in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007f87276ed1d6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#22 0x00007f8726caf56e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#23 0x00007f8726057cd3 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#24 0x00007f87260d5554 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#25 0x00007f87260d444f in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007f87260fbfa2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#27 0x00007f8721561ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f8721561de8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f8721561ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f8726cddbf6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#31 0x00007f87260fbc1e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#32 0x00007f8726cae2bf in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#33 0x00007f8726cae548 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#34 0x00007f8726cb3708 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#35 0x000000000041839b in main (argc=1, argv=0x7fffbb279998) at /home/coates/kde-devel/src/kpat/main.cpp:325
Comment 3 mahlzahn 2013-05-18 17:04:46 UTC
Created attachment 79951 [details]
broken game forty eight 1028370245
Comment 4 kavol 2016-10-04 19:16:34 UTC
Created attachment 101416 [details]
broken solver

same here ...
kpat 3.6
KDE Frameworks 5.26.0
Qt 5.6.1 (built against 5.6.1)
Comment 5 Ian Wadham 2020-07-19 03:42:25 UTC
I know how to fix this problem --- patch being prepared.
Comment 6 Ian Wadham 2020-07-19 04:07:13 UTC
There are further comments and attachments about this bug at https://bugs.kde.org/show_bug.cgi?id=290647#c5 and subsequent comments. Unfortunately we did not realize that this "illegal moves" bug is a separate bug to bug 290647 - Forty & Eight solver falsely reports "Game cannot be won".
Comment 7 Bug Janitor Service 2020-07-24 21:58:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/games/kpat/-/merge_requests/3
Comment 8 Albert Astals Cid 2020-07-24 21:58:55 UTC
Git commit 81b9e3eb8deabcd0faae19ca5aaa6f2a65d33365 by Albert Astals Cid, on behalf of Ian Wadham.
Committed on 24/07/2020 at 21:57.
Pushed by aacid into branch 'release/20.08'.

Fix the Forty & Eight solver making illegal moves

M  +8    -1    patsolve/fortyeightsolver.cpp

https://invent.kde.org/games/kpat/commit/81b9e3eb8deabcd0faae19ca5aaa6f2a65d33365