aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 4f8c4ced54d2b74fc101123cc94122a77f251c8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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](http://xkcd.com/903/) 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.