QB64 Phoenix Edition
UnscramblePic.bas - Rotate picture pieces puzzle - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://staging.qb64phoenix.com/forumdisplay.php?fid=26)
+---- Forum: Dav (https://staging.qb64phoenix.com/forumdisplay.php?fid=34)
+---- Thread: UnscramblePic.bas - Rotate picture pieces puzzle (/showthread.php?tid=1844)

Pages: 1 2


UnscramblePic.bas - Rotate picture pieces puzzle - Dav - 07-14-2023

UNSCRAMBLEPIC.BAS is a relaxing picture puzzle for all ages.  A picture is shown, then broken up into pieces which are randomly rotated in different positions.  Your goal is to rotate each piece back into the correct direction so they will show the correct picture again.  This program uses a built-in image, but you could supply your own image instead (look in the code for that place).

Use the mouse and click on the pieces to rotate them.  Left click will turns them clockwise, right click turns them counter clockwise.  If you get stuck, you can press SPACE to briefly show the solved picture.  The included picture is shown below (picture was made in a QB64 program).

- Dav

EDIT: Code fixed!  Re-download please.  (Thanks Steffan-68!)

.bas   unscramblepic.bas (Size: 51.2 KB / Downloads: 65)

   


RE: UnscramblePic.bas - Rotate picture pieces puzzle - PhilOfPerth - 07-14-2023

Hi Dav.
Looks interesting, but I get a message " Line 797: Memory region out of range." Do I need to input an image or something?


RE: UnscramblePic.bas - Rotate picture pieces puzzle - JRace - 07-14-2023

(07-14-2023, 04:28 AM)PhilOfPerth Wrote: Hi Dav.
Looks interesting, but I get a message " Line 797: Memory region out of range." Do I need to input an image or something?

I get that, too.  Looks like it's the _MEMPUT statement.


RE: UnscramblePic.bas - Rotate picture pieces puzzle - CharlieJV - 07-14-2023

That's the funniest timing.  I just spent the last 4 hours or so building a very primitive version of what you've posted  tile-sliding puzzle.


RE: UnscramblePic.bas - Rotate picture pieces puzzle - JRace - 07-14-2023

It works just fine when I supply an external image...

Code: (Select All)
'====================================================
'Load your own image below, instead of my built-in one.
pic& = _LoadImage("TEST.PNG", 32)
'pic& = BASIMAGE1& 'load my ugly pic
_PutImage (0, 0)-(_Width, _Height), pic&
_FreeImage pic&
'====================================================

...but no luck so far with the internal one.


RE: UnscramblePic.bas - Rotate picture pieces puzzle - PhilOfPerth - 07-14-2023

Yes, I got it to work with my own pic; It looks great!


RE: UnscramblePic.bas - Rotate picture pieces puzzle - Dav - 07-14-2023

Hmm, dunno why that error happens unless the copy/paste code is messing some characters up.  It's working for me here.  I replaced the code block with a .BAS file to download instead.  Could you try to run that and see if the error still happens?  

Direct link --> unscramblepic.bas

Thanks for trying it out! 

- Dav


RE: UnscramblePic.bas - Rotate picture pieces puzzle - Steffan-68 - 07-14-2023

(07-14-2023, 12:01 PM)Dav Wrote: Hmm, dunno why that error happens unless the copy/paste code is messing some characters up.  It's working for me here.  I replaced the code block with a .BAS file to download instead.  Could you try to run that and see if the error still happens?  

Direct link --> unscramblepic.bas

Thanks for trying it out! 

- Dav
The error is still present at line 797.
But the culprit is in line 796 ('btemp$ = _Inflate$(btemp$) ') _Inflate$ is responsible for the error.
The error has been known since version 3.7, but has not yet been fixed.

Here I had already asked a question and got the answer from DSMan195276.
https://staging.qb64phoenix.com/showthread.php?tid=1662&page=3


RE: UnscramblePic.bas - Rotate picture pieces puzzle - bplus - 07-14-2023

OK I tried the direct link and still get same error. Code looks cleaner without the image creation stuff anyway IMHO.
Nice puzzle! This reminds me of the track you turn tiles until it makes a complete roadway. I did some work on puzzle creations for that.


RE: UnscramblePic.bas - Rotate picture pieces puzzle - Steffan-68 - 07-14-2023

(07-14-2023, 12:01 PM)Dav Wrote: Hmm, dunno why that error happens unless the copy/paste code is messing some characters up.  It's working for me here.  I replaced the code block with a .BAS file to download instead.  Could you try to run that and see if the error still happens?  

Direct link --> unscramblepic.bas

Thanks for trying it out! 

- Dav
Here I have changed your code so that it works again.
Line 796 is now      "btemp$ = _Inflate$(btemp$, m.SIZE)"