GC SF Sp WH BV YL BT CP SA CB CC Back to puzzle

Storybook Forest

Hackin' the Beanstalk

by Yar Woo, Asher Walkover, Ian Tullis (original concept)
Answer: SOURCE FILES

The team interacts with a "hacker typing" terminal; typing just a few letters causes several lines of computer code to display. Someone who knows computer science may recognize some of the code-snippets: they come from implementations of real algorithms, including some pretty-famous ones.

Further exploration may reveal that entering the name of the computer scientist an algorithm's named for displays the code for a function implementing that algorithm. E.g., typing in bresenham displays code for Bresenham's line-drawing algorithm. The "banner" text at the start hints at algorithms; e.g., "Finding the best way through the woods..." suggests DIJKSTRA's shortest-path algorithm.

Very careful examination reveals that each function contains an error. For each algorithm, the team wants to "extract" the letter they typed when the error appeared. E.g., in DIJKSTRA's algorithm, the bad code appears when you type S, so extract S.

Algorithm Present Code Correct Code Wrong-code letter
BRESENHAM if dx < dy if dx > dy brEsenham
CHUDNOVSKY for k in range(1, maxK): for k in range(0, maxK): chUdnovsky
DIJKSTRA unvisited[min_node] < unvisited[node]: unvisited[min_node] > unvisited[node]: dijkStra
EUCLID return b return a euClid
FLOYD return 0, 0 return 1, 0 Floyd
GALE-SHAPLEY matches[w] = 0 matches[w] = m gale-Shapley
KADANE running_sum = i running_sum = 0 kadanE
LUHN parity_check = num_digits ^ 2 parity_check = num_digits % 2 Luhn
POLLARD g = lambda x: (x*x + 1) % x g = lambda x: (x*x + 1) % n pOllard
TARJAN if index >= lowlinks[node]: if index == lowlinks[node]: taRjan
VITERBI x[i - 1] = T2[x[0], i] x[i - 1] = T2[x[i], i] viterbI

Ordering based on the algorithm-clues in the "banner" text gives the answer:

Finding the best way through the woods dijkStra
Planning the best way to divide up all these beans equally pOllard
Calculating the area of the circular field chUdnovsky
Asking around to see which of the townspeople know each other really well taRjan
Figuring out the proper fraction of crops to rotate this year euClid
Determining which contiguous section of land produced the most wheat kadanE
 
Seeing if the beanstalk has any loops in it Floyd
Trying to determine the most likely thing the giant said viterbI
Verifying the bean/cow transaction Luhn
Drawing the beanstalk as a straight line brEsenham
Pairing cows and bulls gale-Shapley

The letters spell out SOURCE FILES, the puzzle's solution.