aboutsummaryrefslogtreecommitdiffstats

The Search for Wisdom

This is a simple script that takes a single input word and finds how many clicks it takes to get from its Wikipedia page to a Philosophy article by following all links in articles in a recursive tree. It was inspired by the mouse-over on this XKCD comic but has since taken a better algorithm.

Install

git clone http://git.zx2c4.com/wiki-philosophy
npm install jsdom -g

Usage

node wiki-philosophy.js word [target]

To measure word's distance to "Philosophy":

node wiki-philosophy.js word

You may also measure word's distance to any arbitrary target:

node wiki-philosophy.js word target

Example

$ node wiki-philosophy.js seinfeld
Fetched Seinfeld
Fetched Sitcom
Fetched Larry David
[snipped]


== Philosophy found, sophia achieved! ==

Seinfeld
        Nihilism
                    Philosophy

Bugs

Since we don't wait until each level of the tree is completed, it's possible that certain page requests could finish earlier than others, and the BFS would be slightly modifed to descend down a level in an odd spot.