<div dir="ltr">Hello,<div><br></div><div>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.</div>
<div><br></div><div>Thanks!</div><div>Tara</div><div><br></div><div><div>Dim x1 As Integer</div><div>Dim x2 As Integer</div><div>Dim x3 As Integer</div><div>Dim x4 As Integer</div><div>Dim y1 As Integer</div><div>Dim y2 As Integer</div>
<div>Dim y3 As Integer</div><div>Dim y4 As Integer</div><div><br></div><div>x1 = random(36, 42)</div><div>y1 = random(38, 60)</div><div><br></div><div>Do</div><div>x2 = random(36, 42)</div><div>y2 = random(38, 60)</div><div>
x3 = random(36, 42)</div><div>y3 = random(38, 60)</div><div>x4 = random(36, 42)</div><div>y4 = random(38, 60)</div><div><br></div><div><br></div><div>Loop While (x2 = x1 Or x2 = x1 + 1 Or x2 = x1+2 Or x2 = x1 - 1 Or x2 = x1 - 2 _</div>
<div>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)_</div><div>Or (x3 = x1 Or x3 = x1 + 1 Or x3 = x1+2 Or x3 = x1 - 1 Or x3 = x1 - 2 _</div><div>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)_</div>
<div>Or (x3 = x2 Or x3 = x2 + 1 Or x3 = x2+2 Or x3 = x2 - 1 Or x3 = x2 - 2 _</div><div>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)_</div><div>or (x4 = x1 Or x4 = x1 + 1 Or x4 = x1+2 Or x4 = x1 - 1 Or x4 = x1 - 2 _</div>
<div>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)_</div><div>Or (x4 = x2 Or x4 = x2 + 1 Or x4 = x2 + 2 Or x4 = x2 - 1 Or x4 = x2 - 2 _</div><div>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)_</div>
<div>Or (x4 = x3 Or x4 = x3 + 1 Or x4 = x3 + 2 Or x4 = x3 - 1 Or x4 = x3 - 2 _</div><div>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)</div><div><br></div><div>c.SetAttrib "x1", x1</div>
<div>c.SetAttrib "x2", x2</div><div>c.SetAttrib "x3", x3</div><div>c.SetAttrib "x4", x4</div><div>c.SetAttrib "y1", y1</div><div>c.SetAttrib "y2", y2</div><div>c.SetAttrib "y3", y3</div>
<div>c.SetAttrib "y4", y4</div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:e-prime+unsubscribe@googlegroups.com">e-prime+unsubscribe@googlegroups.com</a>.<br />
To post to this group, send email to <a href="mailto:e-prime@googlegroups.com">e-prime@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/e-prime/CAKtjwHwOZDrq0o4ZQjAWQF9YfCv8isAEyPUg%2BucbUmqi6Py70A%40mail.gmail.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/e-prime/CAKtjwHwOZDrq0o4ZQjAWQF9YfCv8isAEyPUg%2BucbUmqi6Py70A%40mail.gmail.com</a>.<br />
For more options, visit <a href="https://groups.google.com/d/optout">https://groups.google.com/d/optout</a>.<br />