PDA

View Full Version : It is a Mystery



Rob Oplawar
January 20th, 2010, 04:15 PM
Ok, over Christmas break I was looking through my notebook and I found this mysterious algorithm, written in my own handwriting (see first image). I was intrigued, as I couldn't remember writing this algorithm. Now, I am completely perplexed, as I cannot figure out what the fuck the algorithm does.

I will briefly summarize it in pseudocode here:



int[] M = {2,4,7,8,14,16,28,56} // these are all the divisors of 112, discounting 1 and 112.

function[] F = {function pointers...}

// this is an example of an F function (each one has the same interface):
boolean f(by reference: int j, by reference: int k, int[][] input) {
if(++k >= input[k].size) {
k = 0;
if(++j >= input.size) {
return false;
}
}
return true;
}
// each of those functions provides a different path to step j and k through the 2D input array
// when the function finishes stepping through the whole 2D array, it returns false

int[] solve(int m, function f, int[][] input) {
int i = j = k = l = 0
int[] result = {0}
do {
result[i] += (input[j][k] * (2^l))
if(++l > m) {
l = 0
i++
result[i] = 0
}
} while( f(j, k, input))
return result
}

int[][] input = // input is some unknown 2D array of integers

for each M as m {
for each F as f {
// no idea what to do with the output
print solve(m, f, input)
}
}


Yes, I know the variable names are god-awful. That's what's written in my notebook. I'm just as stumped about what each one is for as you are.

The lines of interest are
int[] M = {2,4,7,8,14,16,28,56}
and
result[i] += (input[j][k] * (2^l))

As I said before, M is all the divisors of 112. What is special about 112? No clue. In binary it is written as 1110000, which almost seems significant, but could just as easily be meaningless. It seems to have something to do with factorization, but I have no clue.

Then it's tracking sums of values from the input array times two to the l, which is an integer from 1 to m at any given time. I just realized that what this is effectively doing is shifting the bits by one position on each addition; this seems like a key aspect to the algorithm.

The real head-scratcher is what the fuck is the input? The input probably has some sort of significance, ie, I suspect this algorithm wants to do something very specific for a very specific input. I can almost recall writing this, and there's some memory of searching for an optimal solution among the different F implementations- different paths for traversing the input.

On my tests I've used an input that looks like
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
but that's completely arbitrary.

For m = 2, f = [the example implementation shown above], and input = [sample input shown above], the output of solve is
17, 38, 59, 80, 101, 16.
... *shrugs*


So, there's a slim chance that I actually wrote this algorithm when I was either asleep or drunk off my ass. The handwriting seems too legible for either of those, but you never know. This could just be a bunch of gibberish. I don't think it is, though. It seems very structured and very deliberate. It definitely does *something*! Then again, even when I'm perfectly sober I tend to make mistakes in the first draft of my pseudocode. The algorithm here could have some specific purpose but entirely fail to achieve that purpose because of some mistake. How can we tell what was intentional from what wasn't?


Arglblarbl, this is driving me crazy!

http://hphotos-snc3.fbcdn.net/hs125.snc3/17256_810459615373_10240225_46642246_5176962_n.jpg
The original algorithm as found in my notebook. I have no recollection of when or why I wrote this. Note the little zig-zags at the bottom- those are visual representations of the way the different F functions advance j and k through the 2D array.

http://photos-d.ak.fbcdn.net/hphotos-ak-snc3/hs145.snc3/17256_810459839923_10240225_46642249_1708824_n.jpg
I transcribed it all onto the whiteboard in the CSEL. Hopefully someone will come by and instantly recognize the algorithm's purpose so I can stop going crazy.

rossmum
January 20th, 2010, 06:30 PM
i wish i was cool enough to write ridiculously complex algorithms while off my face :smith:

Limited
January 20th, 2010, 06:40 PM
Perhaps a tutor gave you the algorithm on the board, and you have to quickly scribble it down and missed vital info? That happened to me yesterday, bloody nightmare the lecturer was going way too fast to write it down and explaining the code and transposing the algebra to make the output T.

Doesnt seem to hard though, your only processing the number once (input[j][k] * (2^l)), seems like it used a control set of inputs. Perhaps it didnt actually do any thing useful? Just played with the numbers? :D

Kalub
January 20th, 2010, 06:43 PM
Haha, brilliant. So obscure even you can't solve it.

klange
January 20th, 2010, 07:00 PM
You're bitshifting the matrix and then running a filter on it. Beyond that, it's rather meaningless.

Rob Oplawar
January 20th, 2010, 07:33 PM
You just possess no sense of mystery, do you, klange? You could at least pretend to be curious as to its purpose.

kid908
January 20th, 2010, 09:08 PM
Encryption? Maybe your split personality is a hacker.

jcap
January 20th, 2010, 09:31 PM
It is a prophecy.

klange
January 20th, 2010, 09:45 PM
The divisors of 112 are clearly an obscure reference to 2012. Your algorithm determines the likelihood of the demise of the planet during that year. And it does not bode well. :tinfoil:


But seriously, you were drunk and wrote a shitty matrix filtering thingy.

Kornman00
January 21st, 2010, 12:25 AM
The divisors of 112 are clearly an obscure reference to 2012. Your algorithm determines the likelihood of the demise of the planet during that year. And it does not bode well. :tinfoil:


But seriously, you were drunk and wrote a shitty matrix filtering thingy.
How do we know...that the real algorithm didn't get shifted itself due to the altered state of mind :raise:

You could have changed the names and numbers to throw off would be solvers

The only way to remember what the real parts is to get shit faced again...bottoms up

Rob Oplawar
January 21st, 2010, 12:47 AM
The only way to remember what the real parts is to get shit faced again...bottoms up

I'll drink to that. :beer: