Friday Puzzler: The Quest for Foo

This post is more than 2 years old.

My readers know I'm an avid video gamer, and I've been reading the reviews for Skyrim, the latest Elder Scrolls game with great interest. One of the more interesting facts I read this week was that the game would support infinite, randomly generated quests. While these quests will - probably - be somewhat simple - it is an interesting concept and probably something that was fun to code.

So with that being said, your Friday Puzzler is to create this concept. No, I'm not asking you to build a RPG. Not at all. Rather, I'm asking you to simply generate a quest description in text. You can go serious...

Travel to the mount of San'tooth and find the evil necromancer Lord Maelneborn. Slay him and bring back the Amulet of Kings so that peace be returned to the kingdom.

Or not so serious...

Travel to the mount of the Slightly Lemon-Scented Peaks of Fred. Slay the not-terribly-evil-just-a-bit-lazy accountant Bob and bring back the Sword of Copy and Paste+1.

As always, this should be fun, quick, and please use pastebin to share your code. You can paste the results in the comment though.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Danny posted on 11/11/2011 at 8:20 PM

This one was fun! Reminded me of the quest giver in the old MUDs I used to play.

http://pastebin.com/WJSt60W2
<cfset oQuest = createObject("component","quest").init()/>
<cfoutput>#oQuest.generateQuest()#</cfoutput>

On a video game note: Ray, you gonna be playing any SWTOR?

Comment 2 by Raymond Camden posted on 11/11/2011 at 8:25 PM

I've got SWTOR pre-ordered. Can you run your code a few times and post the results? (Yes, I'm being lazy.)

Comment 3 by Danny posted on 11/11/2011 at 8:28 PM

Got the CE pre-ordered myself. Playing the beta this weekend, very excited :).

Here's some output:
Brave adventurer! There is a terrible threat to our kingdom. You must find and slay Tim. They were last seen near The Galaxy of Terror. Find them, slay them and untold riches shall be yours!

My Friend! I'm glad you are here. Could do me a favor? I need you to deliver Super Robot Gloves to my good friend King BadGuy The 3rd in The Zone of No Return. KTHXBAI!

Psst. Come closer. I have heard tale of Sword of 10000 Truths. Rumor has it that it is located in Teddy Bear Junction. All that's left is for someone to claim it!

Greetings! I was wondering if you could do me a favor. My good friend Tim has crafted Sword of 10000 Truths for me. Could you travel to Mt Death and get it for me?

Comment 4 by Dan Miller posted on 11/11/2011 at 8:52 PM

Not quite as elegant as some but still a lot of fun:

http://pastebin.com/ECQsBL93 (cfm page)
http://pastebin.com/VgMevdqe (cfc)

Random text generated:
Travel to the mount of the Copy and Paste of Bob. Slay the 404 not found Bob and obtain the armor of Buffer Overflow +9.

Journey to the village of the Slightly Moistened of Joe. Destroy the Buffer Overflow James and steal the gauntlets of 404 not found +3.

Travel to the valley of the Butress of Cunning of Bill. Fragment the Butress of Cunning James and steal the gem of Buffer Overflow +2.

Comment 5 by Kristian posted on 11/11/2011 at 9:17 PM

Not exactly random but pretty funny:
http://pastebin.com/WJSt60W2

Couple of outputs:
Don Patrick Tosney it has recently come to our attention that Seth Balboa has been stealing Our Money. You must Destroy Seth Balboa to ensure the safety of Our Money. We are all counting on you Patrick Tosney, do not let us down!

Stop John Platts before it is too late and he Destroy you. John Simmonds , it is vital for The Gold that you do not fail!

There has been a raid on The Swag by the dastardly Peter Kilgallon. The people have chosen you, Don Kurt Platts as their champion. Lambast all comers on the road to Lambast Peter Kilgallon!

Comment 6 by Kristian posted on 11/11/2011 at 9:20 PM

copy and paste skills not great here is my link:
http://pastebin.com/b6MSUgxQ

Comment 7 by crashbox posted on 11/12/2011 at 1:56 AM

a very fun exercise. not the most elegant or random....

result:
"Skip to Walmart and find Michele Bachmann. Noogie her and bring back Boyzoid's Cooler so that civil unrest can be returned to the Round Table."

http://pastebin.com/6YgBNny5

Comment 8 by Tim Cunningham posted on 11/12/2011 at 3:06 AM

http://pastebin.com/aTNFnukC

I am using AngularJS and ColdFusion. You can submit stories (like a madlib) and will save these to a JSON file and then randomly generate Quests from all the user submitted entries:

Example that I just refreshed:

Travel to the city of New York and slay Herman Cain.
Retrieve the ColdFusion and restore balance to the lives of the Mistborn!

Comment 9 by Tim Cunningham posted on 11/12/2011 at 3:16 AM

You can see a working web version of mine here:
http://cfmumbojumbo.com/que...

Comment 10 by Raymond Camden posted on 11/12/2011 at 3:23 AM

Nice use of Angular there. :)

Comment 11 by Tim Cunningham posted on 11/12/2011 at 4:57 AM

Thanks, Ray! I love how easy and slick the two way databinding in AngularJS is. See how the text fills out in the preview section as you type? That would have taken a fair amount of boilerplate JS to do from scratch. As well as the datavalidation.

Comment 12 by Shawn Bowman posted on 11/22/2011 at 10:57 PM

Nice....Tim...