Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Celebrities > Cecil Adams > Re: One for the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 33 of 40 Topic 22308 of 25510
Post > Topic >>

Re: One for the programmers or maths/logic geeks

by huey.callison@[EMAIL PROTECTED] May 14, 2008 at 02:31 AM

Snidely <Snidely.too@[EMAIL PROTECTED]
> wrote:
> On May 13, 10:40 pm, huey.calli...@[EMAIL PROTECTED]
 wrote:
> > 3) it makes the code ****table, because then anybody can start the
> >    object in any space, and it'll find its own borders. If he
> >    hardcodes the space it's allowed to go in, it only works in his
> >    space.
> I wasn't hardcoding the space.  I was discovering the space.  I just
> wasn't modelling 1 single bird in flight.

Well, if you wanted to speed it up, you could make it a silent bird 
with a telescope that was capable of hyperspace-jumps from point to 
point, and rewrite my algorithm as follows

If (distance) is more than one unit away,
  look (distance) in (direction). Do you own that? 
    If so, go there and iterate. 
    If not, iterate looking distance/2. 
  If not, you've found an edge. Iterate with (distance=as far as you can 
    go) and (direction = direction + 90deg) 

Call that initially with distance="as far as you can look" and a random
direction, and it finds the same rectangles I found with the last one --
which aren't the edges, just some rectangle bounded by the edges,
depending on the shape you're in and where you start in that shape. 

Following the edge exactly is harder. Once you've found the edge in the 
above one, instead of iterating again, you'd need to go: 

Have you been here before? If not, 
 Look around
 in case (you own:) 
  squares to your left and front:  /* you're following the right-hand wall
    take a step forward and iterate
  squares to your left and right, but not in front of you: /* looking at
wall
    turn left, take a step forward, and iterate
  squares to your left:  /* you've found a corner
    turn left, take a step forward, and iterate
  none of those three squares: /* you're at the end of a blind alley
    turn around, take a step forward, and iterate
  sqares to your right (regardless of owner****p of the other two)
   /* meaning that you've lost the wall
   turn right, take a step forward, and iterate
 If so, we're done.

The first piece of code, you don't need to store anything, because all 
it's doing is finding one random spot on the wall. The second one will 
actually find your fenceline, so if you need the exact boundaries of 
everything, you'd need to store all of that. But an invisible massless 
hummingbird still ought to be able to do it pretty fast. 

Next question: Your invisible massless hummingbird tells you: 
(8,6)
(8,7)
(8,8)
(8,9)
(8,10)
(7,10)
(7,9)
(6,9)
(5,9)
(5,8)
(4,8)
(3,8)
(3,7)
(2,7)
(2,6)
(1,6)
(1,5)
(0,5)
(0,4)
(1,4)
(1,3)
(1,2)
(2,2)
(2,3)
(2,4)
(3,4)
(3,3)
(3,2)
(3,1)
(4,1)
(4,2)
(5,2)
(5,1)
(5,0)
(6,0)
(6,1)
(6,2)
(6,3)
(6,4)
(7,4)
(8,4)
(8,5)
(8,6)

....now, that's an ugly-ass figure. How do you code other objects to 
efficiently stay within the bounds of that? 

I think the moral of this story is "Well, don't do that then".
Only own rectangular parcels.

-- 
Huey
 




 40 Posts in Topic:
One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-10 18:23:04 
Re: One for the programmers or maths/logic geeks
UaNeill@[EMAIL PROTECTED]  2008-05-10 10:33:01 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-11 01:12:21 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-11 02:20:50 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-11 15:30:04 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-14 00:34:41 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 01:24:38 
Re: One for the programmers or maths/logic geeks
spam.sc@[EMAIL PROTECTED]  2008-05-20 09:34:23 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-21 04:34:33 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-12 20:47:49 
Re: One for the programmers or maths/logic geeks
"Don K" <dk@  2008-05-10 14:35:57 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-11 15:36:15 
Re: One for the programmers or maths/logic geeks
"Don K" <dk@  2008-05-11 13:17:01 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 01:31:39 
Re: One for the programmers or maths/logic geeks
xhoster@[EMAIL PROTECTED]  2008-05-11 21:52:24 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-12 20:39:33 
Re: One for the programmers or maths/logic geeks
xhoster@[EMAIL PROTECTED]  2008-05-13 16:47:25 
Re: One for the programmers or maths/logic geeks
Greg Goss <gossg@[EMAI  2008-05-13 22:23:09 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-14 06:31:58 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-14 01:40:34 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 01:50:25 
Re: One for the programmers or maths/logic geeks
ebenZEROONE@[EMAIL PROTEC  2008-05-14 07:07:41 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-14 06:27:08 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-14 00:40:32 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-13 10:55:01 
Re: One for the programmers or maths/logic geeks
Bob Ward <bobward@[EMA  2008-05-13 13:19:29 
Re: One for the programmers or maths/logic geeks
Opus the Penguin <opus  2008-05-14 02:26:49 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-14 06:28:15 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-14 01:24:52 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-13 23:01:18 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 01:52:57 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-13 23:03:26 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-14 02:31:41 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 02:03:57 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-20 01:45:19 
Re: One for the programmers or maths/logic geeks
Snidely <Snidely.too@[  2008-05-20 12:21:44 
Re: One for the programmers or maths/logic geeks
xhoster@[EMAIL PROTECTED]  2008-05-20 19:42:30 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-21 05:12:16 
Re: One for the programmers or maths/logic geeks
huey.callison@[EMAIL PROT  2008-05-21 01:56:55 
Re: One for the programmers or maths/logic geeks
John Hatpin <RemoveThi  2008-05-21 19:39:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Dec 4 14:20:30 CST 2008.