Am I Correct In Thinking That The Search Engine Cheats?

Home Forums Code, Bugs, Suggestions, Questions Am I Correct In Thinking That The Search Engine Cheats?

This topic contains 2 replies, has 2 voices, and was last updated by  Joshua Barretto 1 year ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #22606 Reply

    Joshua Barretto

    I’m a programmer. Code is no stranger to me, and I take a particular interest in pseudorandom procedural generation.

    So when I heard about this, I was initially not too bothered. Sure, it’s a cool idea. Use a static seed to produce random characters for each page. You can even use some slightly more complex (but not particularly difficult for someone with experience) methods to ensure that the algorithm will generate every possible permutation of pages. But then I encountered the search engine.

    This is impressive. The library is generated with a reversible function that can take a page of data as input, and convert it back into a number that exactly indexes its location. It’s complex, but I can imagine it must be done through some kind of bitwise fiddling that preserves the integrity of the original index as it passes through the function.

    What really, really shocked me was the ability to search for text within a page. This struck me as pretty amazing: after all, the text for each page is presumably generated with a recursive function based on its index. So the algorithm would have to predict the result of the future recursions of a near-infinite class of functions: an intractable problem.

    Then, it struck me. There’s an easy solution. A back door. A cheat. The search algorithm doesn’t need to find the first instance of a piece of text, it only has to find an instance of it. So when searching for a piece of text less than 3,200 characters long, it simply pads the text out on both ends with pseudorandom characters (presumably using the search text as a seed, to ensure that all later searches of the same text will produce the same library index).

    If this is so, then I must say: Congratulations on finding such a clever yet convincing cheat (although given the intractability of the original problem, I can hardly blame you for using it).

    #22607 Reply


    Your assumption is correct! What a sight for sore eyes, having another programmer around here. Just a minor note: The search generates the seed from a page using the inverse PRNG algorithm; the page isn’t the seed itself. I’m not sure if that’s what you meant, but wanted to mention it just in case.

    Fun fact: If your search consists of a full page of 3200 characters, your first result will always be in the same location.

    #22619 Reply

    Joshua Barretto

    I’ve written a clean room re-implementation of the library (i.e: without looking at any Library of Babel code) that you can find here if anyone is interested:

    It allows you to find exact text matches in the library, find text within a page and read any page you care to look at.

    Of course, the interface is command-line only and is abysmal. But as a point of theory, it’s an example that people can learn from.

    ~ Joshua

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Am I Correct In Thinking That The Search Engine Cheats?
Your information: