Pentominoes

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Pentominoes

Post by richmond62 » Sat Jan 31, 2015 9:23 pm

These are great fun: http://en.wikipedia.org/wiki/Pentomino

and it is dead easy to set up a base for this sort of thing . . .

one of the problems seems to be working out if shapes are overlapping each other.
OverlapProblem.png

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Sat Jan 31, 2015 9:57 pm

Rotating non-square images still STINKS:

set the angle:
angle.png
angle.png (5.83 KiB) Viewed 11957 times
rotate:
rotate.png
rotate.png (9.57 KiB) Viewed 11957 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Sun Feb 01, 2015 11:56 am

slowly.png
So: I've implemented the daft shapes, the rotation buttons, and made them into groups with a script in each button to rotate each shape
and a script in each shape to drag each group.

Now the fun really starts with all those little white TARGETS and how to do the INTERSECT code.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Sun Feb 01, 2015 7:57 pm

Obviously THIS is not "on":
bosh.png
bosh.png (7.9 KiB) Viewed 11882 times
The dark green-grey around the grid of targets is an image "MASQ" where the bit
that overlaps the grid if targets (well, lies behind it) is completely transparent.

Now the green block contains the following code, which should send it 'home' if it overlaps
any of "MASQ", but as you can see from the picture above does not:
intersectCode1.png
intersectCode1.png (11.27 KiB) Viewed 11882 times
I wonder why?

If one leaves out "pixels" the shape returns home even when it is inwith the transparent area.

paul_gr
Posts: 319
Joined: Fri Dec 08, 2006 7:38 pm
Location: Blenheim, New Zealand

Re: Pentominoes

Post by paul_gr » Mon Feb 02, 2015 7:28 am

richmond62 wrote:Rotating non-square images still STINKS:
It's been stinking for the last 5 years or so...
I lost a lot of hair working on rotation of various objects...

Paul

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Mon Feb 02, 2015 7:29 pm

Well, I have found the best way to deal with this problem is to overlay one's image on a square graphic which
is transparent and has 0 width borders: group the 2: give them a daft name such as "DAFT" and then do this
in the Message box:

import snapshot from group "DAFT"

and, Hey-Nonny-Nonny-Nonny-No (and other equally meaningless magic-sounding phrases)
one ends up with a square image containing one's original image, at which point you
can rotate it to your heart's content without any distortion.
Last edited by richmond62 on Tue Feb 03, 2015 11:25 am, edited 1 time in total.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3998
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Pentominoes

Post by bn » Mon Feb 02, 2015 8:53 pm

Hi Richmond,

you might want to have a look at this post from Jim James Hurley to the use-list.

http://runtime-revolution.278305.n4.nab ... l#a4276694

Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3998
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Pentominoes

Post by bn » Mon Feb 02, 2015 9:01 pm

Or you might want to see Jim James Hurley's idea in a stack

I don't know if this helps.

Kind regards

Bernd
Attachments
turnImageCenterOfMassII.livecode.zip
(76.64 KiB) Downloaded 356 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3998
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Pentominoes

Post by bn » Mon Feb 02, 2015 9:08 pm

Hi Richmond,

from the dictionary
The current setting of the resizeQuality property is used to determine whether to apply filtering to the rotation operation. If set to normal no filtering is used; if set to good or best a bilinear filter is used which significantly reduces the distortion that will naturally occur when an image is rotated.

The rotation operation does not have an inverse. Since some amount of distortion is unavoidable when rotating an image by an amount that is not a multiple of 90 degrees, rotating an image clockwise, then counterclockwise by the same amount does not completely restore the original image.
And
To rotate an image in a reversible way, or to do repeated rotations without progressive distortion of the image, set its angle property instead of using the rotate command. Unlike the rotate command, the angle property affects only the screen display of the image, not the actual picture data in it, so setting it repeatedly does not introduce distortion.
I would use angle, see stack above

Kind regards
Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Tue Feb 03, 2015 11:25 am

Thanks, Bernd,

I'm not really having a vast problem with rotation because, as I wrote earlier, I make sure
that all non-square images are "embedded" in a square, transparent space.

However, I do think that, in the great scheme of things, it would ne super if one
could roatet non-square images, as they are - Ding-an-Sich, without distortion.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Tue Feb 03, 2015 11:26 am

What I am much more troubled about is the fact that "threshhold" with
INTERSECT does not appear to work properly.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3998
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Pentominoes

Post by bn » Tue Feb 03, 2015 11:40 am

Hi Richmond,
did you try the stack I posted?

Kind regards

Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Tue Feb 03, 2015 12:16 pm

Yes, I did, and I cannot see how that helps with THRESHOLD in any way whatsoever as that stack only uses one image.

However, I seem to have solved the THRESHOLD problem:
threshold.png
thresher.livecode.zip
(10.57 KiB) Downloaded 376 times
Obviously my image I am using for my Pentominoes game has got something wrong with it.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3998
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Pentominoes

Post by bn » Tue Feb 03, 2015 12:37 pm

Hi Richmond,
Yes, I did, and I cannot see how that helps with THRESHOLD in any way whatsoever as that stack only uses one image.
It was more related to your rotate problem.

Kind regards
Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9356
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pentominoes

Post by richmond62 » Tue Feb 03, 2015 3:51 pm

Aha. Thanks, Bernd, I did not jalouse it was for the rotation "problem".

Post Reply

Return to “Games”