T.R | Title | User | Personal Name | Date | Lines |
---|
860.1 | Off the top of my head... | AKQJ10::YARBROUGH | Why is computing so labor intensive? | Mon Apr 11 1988 13:32 | 11 |
| Let me try an intuition: from any given starting place, pick a direction
and move in that direction as long as the sequence ...c,b,a,c... appears.
When something out of sequence would appear, turn left instead. This should
get you going in the right direction after at most 3 wrong directions, and
take you to the starting point, from where you can calculate the original
position.
An illusory sequence might occur in a place where the original path turns
left, but a letter in correct sequence appears ahead, on an outer turn of
the spiral. What needs to be proven is that no illusory sequences actually
occur (else my algorithm will loop).
|
860.2 | | CADM::ROTH | If you plant ice you'll harvest wind | Mon Apr 11 1988 15:57 | 6 |
| This is suspiciously reminiscant of Stan's plot of primes in a spiral.
A plot of the vertices as colored points on a raster will probably look
nice...
- Jim
|
860.3 | | CADM::ROTH | If you plant ice you'll harvest wind | Mon Apr 11 1988 18:51 | 36 |
| Suppose you colored lattice squares Red, Green, Blue in the
spiral pattern (which is what I would do for making a picture.)
This results in a symmetric pattern with four 'quadrants'
separated by diagonals passing thru the origin like this:
\ ..BGRBGR /
\..BGRBGR /
\ / ..
\ / ..
RR \ / BB
GG GRB GG
BB BRG RR
RR R \ BB
GG / \ GG
BB / \ RR
.. / \
../ RGBRGB..\
/ RGBRGB.. \
Note that in each quadrant, there will be double strips of RGB colors as
shown.
Barring landing on a diagonal or too near the center, you can tell
something about your location and orientation by looking for vertical
or horizontal RGB patterns from where you currently are. Then the idea
could be to follow the RGB strip until you hit a diagonal, which breaks
the symmetry of the repeating colors.
One way to find the origin would be to look for the diagonal in each
direction and then use dead reckoning. It shouldn't be necessary to
actually follow the RGB patterns all the way in along a spiral path.
[I made the spiral above CCW by mistake, sorry about that.]
- Jim
|
860.4 | | POOL::HALLYB | You have the right to remain silent. | Mon Apr 11 1988 19:56 | 7 |
| > One way to find the origin would be to look for the diagonal in each
> direction and then use dead reckoning. It shouldn't be necessary to
> actually follow the RGB patterns all the way in along a spiral path.
Do I hear a contest in the offing? You move 1 square any direction
and some magic software tells you your surroundings and keeps count
of how many moves you have made...
|
860.6 | no neighbour with same letter? Left at fork! | HERON::BUCHANAN | procrastinated laziness | Tue Apr 12 1988 12:33 | 37 |
| Surprising!
Whatever cell you're in, you examine its letter, and that of the 4
neighbouring cells, and you can immediately answer the following questions:
(1) am I at the origin already?
(2) if the answer to (1) is "No", which of the 4 neighbours is the
predecessor on the spiral to the cell I'm currently in?
So by iterating on this, I cannot fail to trace back along the spiral to
the origin.
*
Here's what you do. Find out which of the following maps corresponds to
the particular position you are in (you may have to rotate the map, reflect
the map, or cyclically permute the symbols ABC to find the one that matches).
Then you decide which way to go, knowing that for the particular maps I've
shown, the correct direction to go is WEST.
C B A B C
ABC ABC ABC ABA ABB
C A C C C
Suppose none of these five maps is applicable? Well, then you're at the
origin already.
*
To summarize: when you have a choice between going straight on, and
turning left, go straight IFF one of the adjacent cells is the same letter as
the cell you're on.
*
Does Stan the Man have any more interesting problems?
|
860.7 | Mad Mathematician, part II | CLT::GILBERT | | Tue Apr 12 1988 20:55 | 3 |
| The Mad Mathematician was always a bit overzealous. Instead of
simply erasing the spiral, he also erased all the 'b's and 'c's!
Was Dylan right? Can you go home?
|
860.8 | Mad Mathematician, part III | STAR::HALLYB | Knight-errant says "CI!" | Tue Apr 12 1988 21:27 | 4 |
| The Mad Mathematician was always a bit confused. He laid down a
spiral with some fixed number of symbols A, B, C, E, F, ... but
you weren't told how many. Was Gilbert right when he asked:
Was Dylan right? Can you go home?
|
860.9 | Getting there quicker | SSDEVO::LARY | | Tue Apr 12 1988 21:48 | 15 |
| Some of the replies have mentioned ways to trace back along the spiral;
given any one of those methods, it seems that you can get to the origin a lot
faster with the following modification:
1) Use the algorithm to figure out the way back along the spiral
2) Move one unit in that direction, and then (if you are not at
the origin) take a left and move one unit.
3) Iterate until you hit the origin
The modified algorithm approaches the origin by approximating a spiral that
is inclined 45 degrees to the radius vector, as opposed to the almost-90
degree spiral that the MM drew....
|
860.10 | a little simpler... | SSDEVO::LARY | | Tue Apr 12 1988 21:53 | 6 |
| Step 2 of .-1 can be simplified to "Facing that direction, move one unit to
your left". I was being too scared of corners.
(Presumably, corners can be identified and an even faster method that allows
diagonal moves could be derived...)
|
860.11 | | CADM::ROTH | If you plant ice you'll harvest wind | Wed Apr 13 1988 19:20 | 13 |
| If you're away from the diagonals the plane is tiled with 3 by 3 squares
that are reflections of each other about their diagonals (depending
on which quadrant you're in.)
This means that the best you can do in the midst of these squares is
move toward a diagonal until you hit it.
Then on the diagonal you could track it in toward the origin.
Isn't one of the prior replies an exhaustive case analysis of where to
go given your current location?
- Jim
|
860.12 | Optimal algorithm without diagonals | CLT::GILBERT | | Wed Apr 13 1988 20:43 | 51 |
| Suppose you don't know your orientation, and you can 'see' your square and
the four adjacent squares. Then, if three values in a row (column) are
different, then a particular direction is 'indicated'. For example, in:
? ^
a c b, a movement | (that way) is 'indicated', since the 'abc'
? |
pattern seems to correspond to the pattern 'above' the origin (e.g. the pattern:
a c b a c b
a c b a c b ... ). Two directions may be 'indicated', for example,
c b a c b a
b ^
in: a c b, both | and <-- are 'indicated'.
a |
Through case analysis, we formulate the following rules:
If one direction is 'indicated', go in that direction. If two directions are
'indicated', we are on a diagonal, and the origin is in the direction that
combines the two 'indications'. If no direction is 'indicated', we have one
of the following 5 cases:
b
c a b, we are at the origin;
a
a b c
b a b, c c a, a a b, the origin is SE (southeast);
c b c
c
a b b, the origin is either SW or W (and it's W iff
c we're one square from the origin).
Assuming that we can move to only one of the four adjacent squares, the
above rules can be further distilled:
If some direction is 'indicated', move in that direction.
(if more than one direction is 'indicated', choose either one).
If no direction is 'indicated', face away from the square that
contains the same symbol as the square you're on. If the left-
and right-hand squares have different symbols, you're at the
origin. Otherwise, step forward.
When repeated, this gives a minimal path to the origin, assuming that
diagonal moves are not allowed.
|