Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UnscramblePic.bas - Rotate picture pieces puzzle
#1
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: 59)

   

Find my programs here in Dav's QB64 Corner
Reply
#2
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?
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#3
(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.
Reply
#4
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.
Reply
#5
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.
Reply
#6
Yes, I got it to work with my own pic; It looks great!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#7
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

Find my programs here in Dav's QB64 Corner
Reply
#8
(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://qb64phoenix.com/forum/showthread...662&page=3
Reply
#9
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.
b = b + ...
Reply
#10
(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)"
Reply




Users browsing this thread: 1 Guest(s)