Help with Randomization of Non-Overlapping Images
tamiskovich at gmail.com
tamiskovich at gmail.com
Fri Aug 1 21:43:21 UTC 2014
Thanks for your response David. That is what I was afraid of. Eprime
support said it should work in theory, but seems as though it keeps getting
stuck when I add in the forth image. I am trying to list all the
combinations as well, it is just proving to be a huge task, for there are
an enormous amount of possible combinations.
I was hoping that this would make coding much quicker and truly random.
Tara
On Friday, August 1, 2014 12:54:35 PM UTC-5, Vinson, David: UCL wrote:
>
> I suspect you didn't get any replies before due the impressively
> complicated set of OR statements in that loop. I suspect the problem is
> there somewhere but imagine it world be a nightmare to track it down. My
> guess is the loop never exits, whether due to an error or impossible
> constraints.
>
> What if instead you enumerated the possible legal combinations of
> positions in a nested List and then just sampled one of them per trial?
>
> Good luck,
> David V
>
> ----- Reply message -----
> From: "tamis... at gmail.com <javascript:>" <tamis... at gmail.com <javascript:>
> >
> To: "e-p... at googlegroups.com <javascript:>" <e-p... at googlegroups.com
> <javascript:>>
> Subject: Help with Randomization of Non-Overlapping Images
> Date: Fri, Aug 1, 2014 6:30 pm
>
>
>
> Does anyone have any suggestions on this? I'm stuck on this and eprime
> support directed me here.
>
> Tara
>
> On Monday, July 28, 2014 3:43:33 PM UTC-5, Tara Miskovich wrote:
>>
>> Hello,
>>
>> I am working on having 4 images randomly places within a rectangular
>> region without overlapping. I wrote the code below, and it appears to be
>> working with up to Image 3 added, but when I add in the forth image the
>> program freezes. I am hoping for some guidance with what to try next or how
>> to get past this. Here is the code I wrote to randomize the x and y
>> location for each image.
>>
>> Thanks!
>> Tara
>>
>> Dim x1 As Integer
>> Dim x2 As Integer
>> Dim x3 As Integer
>> Dim x4 As Integer
>> Dim y1 As Integer
>> Dim y2 As Integer
>> Dim y3 As Integer
>> Dim y4 As Integer
>>
>> x1 = random(36, 42)
>> y1 = random(38, 60)
>>
>> Do
>> x2 = random(36, 42)
>> y2 = random(38, 60)
>> x3 = random(36, 42)
>> y3 = random(38, 60)
>> x4 = random(36, 42)
>> y4 = random(38, 60)
>>
>>
>> Loop While (x2 = x1 Or x2 = x1 + 1 Or x2 = x1+2 Or x2 = x1 - 1 Or x2 =
>> x1 - 2 _
>> And y2 = y1 Or y2 = y1 + 1 Or y2 = y1 + 2 Or y2 = y1 + 3 Or y2 = y1 - 1
>> Or y2 = y1 - 2 Or y2 = y1 - 3)_
>> Or (x3 = x1 Or x3 = x1 + 1 Or x3 = x1+2 Or x3 = x1 - 1 Or x3 = x1 - 2 _
>> And y3 = y1 Or y3 = y1 + 1 Or y3 = y1 + 2 Or y3 = y1 + 3 Or y3 = y1 - 1
>> Or y3 = y1 - 2 Or y3 = y1 - 3)_
>> Or (x3 = x2 Or x3 = x2 + 1 Or x3 = x2+2 Or x3 = x2 - 1 Or x3 = x2 - 2 _
>> And y3 = y2 Or y3 = y2 + 1 Or y3 = y2 + 2 Or y3 = y2 + 3 Or y3 = y2 - 1
>> Or y3 = y2 - 2 Or y3 = y2 - 3)_
>> or (x4 = x1 Or x4 = x1 + 1 Or x4 = x1+2 Or x4 = x1 - 1 Or x4 = x1 - 2 _
>> And y4 = y1 Or y4 = y1 + 1 Or y4 = y1 + 2 Or y4 = y1 + 3 Or y4 = y1 - 1
>> Or y4 = y1 - 2 Or y4 = y1 - 3)_
>> Or (x4 = x2 Or x4 = x2 + 1 Or x4 = x2 + 2 Or x4 = x2 - 1 Or x4 = x2 - 2 _
>> And y4 = y2 Or y4 = y2 + 1 Or y4 = y2 + 2 Or y4 = y2 + 3 Or y4 = y2 - 1
>> Or y4 = y2 - 2 Or y4 = y2 - 3)_
>> Or (x4 = x3 Or x4 = x3 + 1 Or x4 = x3 + 2 Or x4 = x3 - 1 Or x4 = x3 - 2 _
>> And y4 = y3 Or y4 = y3 + 1 Or y4 = y3 + 2 Or y4 = y3 + 3 Or y4 = y3 - 1
>> Or y4 = y3 - 2 Or y4 = y3 - 3)
>>
>> c.SetAttrib "x1", x1
>> c.SetAttrib "x2", x2
>> c.SetAttrib "x3", x3
>> c.SetAttrib "x4", x4
>> c.SetAttrib "y1", y1
>> c.SetAttrib "y2", y2
>> c.SetAttrib "y3", y3
>> c.SetAttrib "y4", y4
>>
> --
> You received this message because you are subscribed to the Google Groups
> "E-Prime" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to e-prime+u... at googlegroups.com <javascript:>.
> To post to this group, send email to e-p... at googlegroups.com <javascript:>
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/e-prime/8d0ddea8-f54e-4a98-a006-cdcbed5cc8ce%40googlegroups.com
> <https://groups.google.com/d/msgid/e-prime/8d0ddea8-f54e-4a98-a006-cdcbed5cc8ce%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/a3b0b0f4-3d00-48dd-87f9-84d83b1f93cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20140801/f42c9c3b/attachment.htm>
More information about the Eprime
mailing list