Page 1 of 1
Getting stuck with Pelmanism
Posted: Tue Jun 21, 2016 7:17 pm
by richmond62
I was having a look over here:
https://www.mackiev.com/hsa/index.html
and thought I'd have a go at "
ripping off" their Demo stuff which
Matthias Rebbe very kindly posted here:
http://shoutsoftware.eu/hsa-demo
As a way of
qualifying what I mean by "
ripping off" I should explain that I find it quite stimulating to try to make
functionally identical copies
of other people's software without having any access to their code. Obviously, not wishing to tread on their copyright, I have no intention of
releasing the end result as anything but a learning exercise in coding.
I started with "Find-the-Pair" [a.k.a. Pelmanism]:
link removed as superseded by link in later post.
Which is all very fine as far as it goes.
I have used 12
rectangular graphic objects as my "cards", and set their
backPatterns to various card images
as required.
HOWEVER; where I got a bit stumped was how to ensure that the game did not have the same card layout each time
(the stack here has the same layout each time), and thought about
random but couldn't quite work out how to make
sure I didn't end up with 7 green cows.
Re: Getting stuck with Pelmanism
Posted: Tue Jun 21, 2016 7:26 pm
by Klaus
Hi Richmond,
check my "simple_memory1" stack here:
http://www.major-k.de/xtalk.html (scroll down a bit) and tear it apart
Best
Klaus
Re: Getting stuck with Pelmanism
Posted: Tue Jun 21, 2016 7:35 pm
by richmond62
Thanks, Klaus . . .
I "love" it when you point out that I'm
reinventing the wheel.
I'm downloading the stack right now.
Re: Getting stuck with Pelmanism
Posted: Tue Jun 21, 2016 7:53 pm
by richmond62
"Holiday Memory" from Professor Sanke, here:
http://www.sanke.org/MetaMedia/index.html
Looks worth a look as well.
Re: Getting stuck with Pelmanism
Posted: Wed Jun 22, 2016 6:53 pm
by richmond62
Looking at both Klaus's and Prof. Sanke's stacks I decided to do things differently because:
1. I'm bloody minded.
2. I forgot.
So, here is a simple script that I thought up during a walk in the park today
(trying to keep my mind off the 38 C temperature coupled with 40% humidity).
I will use this in my Pelmanism game. Anybody who wants can use it wherever they find it useful.
Re: Getting stuck with Pelmanism
Posted: Wed Jun 22, 2016 8:10 pm
by richmond62
So, I integrated my pseudo-random routine with my Pelmanism stack:
Click on the red triangle to see the "gory details".
https://www.dropbox.com/s/jbud7elz5grx4 ... e.zip?dl=0
I am well aware that purists will tell me that the thing can be done a whole lot more efficiently using string variables.
The reason I have used fields is so that everything is visible, and therefore somewhat easier to understand.
The thing still needs a spot of work to prevent all sorts of funny things happening if an end-user clicks on a disclosed card.
Re: Getting stuck with Pelmanism
Posted: Wed Jun 22, 2016 9:15 pm
by Ormente
A shuffle function, if that can be useful. It works by swapping chars.
You can also
set the randomSeed to an integer on stack or card opening to have a better randomness (with
the milliseconds for example) or a controlled one (with a fixed integer).
Code: Select all
on mouseUp
put shuffle(field "fABC") into fld "fXYZ"
end mouseUp
function shuffle aString
put length(aString) into tSize
repeat with tCharPos1 = 1 to tSize
put random(tSize) into tCharPos2
if tCharPos2 is not tCharPos1 then
put char tCharPos2 of aString into tChar
put char tCharPos1 of aString into char tCharPos2 of aString
put tChar into char tCharPos1 of aString
end if
end repeat
return aString
end shuffle
Re: Getting stuck with Pelmanism
Posted: Thu Jun 23, 2016 10:33 am
by richmond62
From a coding point of view your coding shuffle may be more elegant, faster and efficient.
However, I'm a bit like the farmer with a broken hay bailer: well, we could use this piece of wire
in the boot of my car, or we could order a spare part, and wait for 3 weeks for its delivery.
Having spent a lot of summers on an island where ordering and waiting for something is
both impractical and a long-standing joke, I'll always reach for the wire, string, Granny's tights,
or whatever is to hand and will do the job.
Re: Getting stuck with Pelmanism
Posted: Thu Jun 23, 2016 11:14 am
by Ormente
So, usefull it is not... Fine!
Re: Getting stuck with Pelmanism
Posted: Fri Jun 24, 2016 12:14 am
by richmond62
Not at all; your code is very useful.