Spiral Bits

Allosentient
Posts: 273
Joined: Thu Apr 10, 2008 9:47 pm

Post by Allosentient »

AMindForeverVoyaging wrote:I'm still trying to find a way to tackle this challenge.

So my first idea was to use the formula of the Archimedean spiral, but because of the jitter to the left and to the right this does not work, at least not without corrections of some kind.

Another idea I had to traverse the spiral goes something like this:
  • 1.) Define possible directions as { up, up/right, right, right/down, down, down/left, left, left/up }
    2.) Define starting point as (x,y) and starting direction as right
    3.) Move (x,y) one pixel in current direction
    4.) Compute "boundary pixels" of (x,y) in such a distance that they are just outside of the spiral, thus black.
    5.) As soon as a "boundary pixel" is not black anymore, a direction in change is needed.
    e.g. if current direction == right and lower boundary pixel is not black anymore, change to right/down
    6.) Repeat 3. to 5. as needed
A problem with this is that this approach needs enough black space around the spiral bits to work, which is not always the case as can be seen in this magnified screenshot: Image Link

So, how do people tackle this? Do you code an exception just for those cases, like filling the data there manually, and then defining a new starting point and direction? Is that a sensible approach?
Try using vector math. Calculate the approximate center of each "region" of the circle and then calculate the angle between it and the previous circle, and then travel in that direction until a new region is reached. Build a list of pixels to check when traveling "forward", pixels which "touch" the vector you are traveling. Rinse and repeat.
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Thank you for the hint Allosentient.
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

Don't try to find formula for the spiral, you would hardly catch the random number generator probably used in the formula.

Try to implement some kind of "best match walk".

If I remember it well, I have drawn to the picture (copy) as the debug tool.
Yes I made green and red dots in the picture :) ... it really helped in debugging.

....I bet I got some information wrongly, but luckily the result was readable enough. I have solved it before I created tools for error recoveries for the "subresult".
So I think the tools could be helpful in localising the point of problem, but they are not crucial.
... this probably was not case of this challenge
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

Maybe following the spiral is easier from one end than from the other.
MrTerry
Posts: 34
Joined: Tue Jan 26, 2010 11:44 am

Post by MrTerry »

is some1 still here who solved this?

i cannot make sense out of these tipps and it drives me crazy.
What kind of encoding is this? some kind of variable length encoding or do i have to perform something with these bits?
Runaway Robot LvL 452
path: DDDRDRDDRRDDRRDRRRDDRRRRDDDRRDDDRRDRDRDRDRRRRRDRRDRRRRRDDRRDDDDRDRRRDRRDDRDRDRRRRRDRDDDRDDRDRRRRDDDDDDRRRRRRR

boom at 1 1
your solution sucked

Oo wtf?
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

MrTerry wrote:is some1 still here who solved this?

i cannot make sense out of these tipps and it drives me crazy.
What kind of encoding is this? some kind of variable length encoding or do i have to perform something with these bits?
Try to write the bits to a file and look inside (in hex editor). ... Consider all symmetries.

... of course you can do first few bits by hand what did I and it gave me enough info.
MrTerry
Posts: 34
Joined: Tue Jan 26, 2010 11:44 am

Post by MrTerry »

ok i m stupid. I thought about the symmetry aspect, but gave up just to early to realize. Many thanks!
Runaway Robot LvL 452
path: DDDRDRDDRRDDRRDRRRDDRRRRDDDRRDDDRRDRDRDRDRRRRRDRRDRRRRRDDRRDDDDRDRRRDRRDDRDRDRRRRRDRDDDRDDRDRRRRDDDDDDRRRRRRR

boom at 1 1
your solution sucked

Oo wtf?
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

MrTerry wrote:ok i m stupid. I thought about the symmetry aspect, but gave up just to early to realize. Many thanks!
Enjoy post Spiral Bits challenges.
MrTerry
Posts: 34
Joined: Tue Jan 26, 2010 11:44 am

Post by MrTerry »

I m having a blast! So far shattered and shuffled, maelstrom and hvm cipher belong to my favourite challenges ever. Even though especially hvm cipher wasnt that difficult. But fun! Glad I came back to hacker org after some years :)
Runaway Robot LvL 452
path: DDDRDRDDRRDDRRDRRRDDRRRRDDDRRDDDRRDRDRDRDRRRRRDRRDRRRRRDDRRDDDDRDRRRDRRDDRDRDRRRRRDRDDDRDDRDRRRRDDDDDDRRRRRRR

boom at 1 1
your solution sucked

Oo wtf?
Post Reply