Bug 358940 - Fifteen puzzle unsolvable
Summary: Fifteen puzzle unsolvable
Status: RESOLVED FIXED
Alias: None
Product: kdeplasma-addons
Classification: Plasma
Component: General (show other bugs)
Version: 5.5.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL: https://en.wikipedia.org/wiki/15_puzz...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-03 05:02 UTC by Malte Eggers
Modified: 2017-05-22 15:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
pull request for patch of fifteenPuzzle logic (46 bytes, patch)
2017-03-23 10:41 UTC, Florian De Maeyer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Malte Eggers 2016-02-03 05:02:59 UTC
At first I thought I just couldn't do it. But then I looked up a solution and it appears that not every combination is even solvable. It appears that most of the time I end up with an unsolvable pattern (everything correct except for the last row where 14 and 15 are exchanged). I once solved the puzzle, although since I can't reproduce that I'm not so sure any more. There was no notification that I made it, I don't know if there is supposed to be one.

Reproducible: Sometimes
Comment 1 Florian De Maeyer 2017-03-23 10:41:00 UTC
Created attachment 104697 [details]
pull request for patch of fifteenPuzzle logic

I submitted a pull request with a fix for the problem but realized this is probably not the correct way to do it, since my pull request is the only open one. Could someone please advise me how to submit this patch?
Comment 2 Florian De Maeyer 2017-03-23 10:45:31 UTC
I experienced the same problem, I never got a solvable puzzle and am convinced the developer has just switched around the logic, so only unsolvable puzzles are generated. The patch is just to change one 0 to a 1, see my other comment.
Comment 3 David Edmundson 2017-03-23 12:44:52 UTC
@Florian:

https://community.kde.org/Infrastructure/Phabricator
Comment 4 David Edmundson 2017-03-23 13:13:21 UTC
Your patch doesn't match your comment.

Note that test for inversions being even or not is not the == 1 at the end but rather then (inversionsMod == 0) which is already there in the current code. 

Note the two sets of == in the same statement

I think you've accidentally changed it to:
 if the size is even and the inversions are even, it's not solvable.
Comment 5 Igor Poboiko 2017-05-22 15:52:30 UTC
Git commit 3516eda8107bda0c91fa8fa5ef7e6da34d995f6b by Igor Poboiko.
Committed on 22/05/2017 at 15:51.
Pushed by poboiko into branch 'master'.

Fix fifteen puzzle solveability

Differential Revision: https://phabricator.kde.org/D5913

M  +2    -2    applets/fifteenPuzzle/package/contents/ui/FifteenPuzzle.qml

https://commits.kde.org/kdeplasma-addons/3516eda8107bda0c91fa8fa5ef7e6da34d995f6b