Bug 330308 - AI plays seriously bad moves against all rules and sanity, game has 33 cards and 130 points.
Summary: AI plays seriously bad moves against all rules and sanity, game has 33 cards ...
Status: RESOLVED FIXED
Alias: None
Product: lskat
Classification: Applications
Component: general (show other bugs)
Version: 1.40
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-23 01:23 UTC by Martin Walch
Modified: 2014-05-07 22:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13.1


Attachments
screenshot of the game after first move (895.83 KB, image/png)
2014-01-23 01:24 UTC, Martin Walch
Details
Comment out the condition on creating a new AI. Always create it. (357 bytes, patch)
2014-05-04 04:37 UTC, Ian Wadham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Walch 2014-01-23 01:23:29 UTC
Alright, I have no clue what is going on there or how to reproduce the bug, but the AI seriously messed up things. As you can see in the following screenshot, the wrong card got uncovered, and things became even worse afterwards. The game ended with no winner 69:61, with the 33rd (!?) card remaining at the AI player. There was no card really duplicate, only one card just did not get uncovered, but counted 10 points.

Reproducible: Couldn't Reproduce
Comment 1 Martin Walch 2014-01-23 01:24:47 UTC
Created attachment 84809 [details]
screenshot of the game after first move
Comment 2 Martin Walch 2014-05-03 22:07:40 UTC
I think I finally found out what probably has happened: when starting a new game while the previous game is not over and a move is currently in progress, the new game starts in an inconsistent state. So to have a chance of reproducing the bug do this:

1. start a new game against ai player
2. make a turn
3. while the animation of the first or the second part of the turn is running press Ctrl+N to start a new game

Depending on when during a move you start the new game and how the cards are distributed, all sorts of strange effects may happen in the new game. (There is also a chance that nothing goes wrong.)
Comment 3 Ian Wadham 2014-05-04 04:37:12 UTC
Created attachment 86446 [details]
Comment out the condition on creating a new AI. Always create it.
Comment 4 Ian Wadham 2014-05-04 04:42:40 UTC
(In reply to comment #3)
> Created attachment 86446 [details]
> Comment out the condition on creating a new AI. Always create it.

I have tested this patch several times in several ways and sanity was always restored.
Comment 5 Martin Walch 2014-05-04 17:27:06 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Created attachment 86446 [details]
> > Comment out the condition on creating a new AI. Always create it.
> 
> I have tested this patch several times in several ways and sanity was always
> restored.

Thank you for that fix. With your patch applied I can not reproduce the problem anymore.

When reporting this bug I did not recognize bug #228067 as the same, but with the new insights how to reproduce the bug, I am pretty sure this is a duplicate of it. (So, the first to document this bug were Raj Mathur and Eckhart Wörner.)

However, now that the fix is attached to this bug report I hesitate to close it as duplicate of the older report #228067.
Comment 6 Ian Wadham 2014-05-07 22:09:08 UTC
Git commit 922d9ced78f6eb319d1049795acef3d8e243fb0b by Ian Wadham.
Committed on 07/05/2014 at 21:58.
Pushed by ianw into branch 'master'.
Related: bug 228067

LSkat AI would play illogically after you hit New during a move.

M  +1    -1    src/mainwindow.cpp

http://commits.kde.org/lskat/922d9ced78f6eb319d1049795acef3d8e243fb0b
Comment 7 Ian Wadham 2014-05-07 22:12:32 UTC
Git commit 46f3b313bf91c9828c63e5be7a8f319254528647 by Ian Wadham.
Committed on 07/05/2014 at 21:58.
Pushed by ianw into branch 'KDE/4.13'.
Related: bug 228067

LSkat AI would play illogically after you hit New during a move.

M  +1    -1    src/mainwindow.cpp

http://commits.kde.org/lskat/46f3b313bf91c9828c63e5be7a8f319254528647