Research
Here come the fun part. While it's usually quite a burden, I always get excited to do the research paper every year. And the cycle is usually something like this: arrive at library, painfully search for books relevant to my topic, lazily write down notes, leave, forget everything, come back the next day, repeat. That is such a precise cycle I could write code for it.
public String research(String topic)
{
if (topic.length() > Integer.MAX_VALUE)
return "";
int x = (int)(Math.random() * topic.length());
return topic + research(topic.substring(x) + topic.substring(0, x) + topic.substring(x);
}
{
if (topic.length() > Integer.MAX_VALUE)
return "";
int x = (int)(Math.random() * topic.length());
return topic + research(topic.substring(x) + topic.substring(0, x) + topic.substring(x);
}
As anyone that knows what this does could tell you it's a nightmarish process filled with recursion and heaps of trouble. For anyone that can't read this, well it already looks like a nightmare to you, doesn't it? However, this guide instills confidence in me that yes, I can do it this time. And ideally, the more I do it the better I should get, right? Regardless, I've been quite restricted in what I could write about in the past. I hope that isn't going to be the case anymore.
For the curious, my first run of this code with the input "RERESEARCH" with a more reasonable value in the base case led to some interesting results. Try it with 1000000. It's hypnotic.
For the curious, my first run of this code with the input "RERESEARCH" with a more reasonable value in the base case led to some interesting results. Try it with 1000000. It's hypnotic.
No comments:
Post a Comment