Skip to main content

Python 373 -> 303

ReadsIt reads the wikipediaWikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spacesone space for the indents and http://enwp.org instead of wikipedia'sWikipedia's full URL to save bytes.

  • -50 because if it finds a broken urlURL it gets a new random urlURL.
  • -20 because it prints the title of each urlURL visited (could change title -> urlURL, but title is cleaner and actually makes my source larger).

It hangs every once and a while, and I can't figure out why. Perhaps because of Wikipedia rate limits?

I found the Boston Red Sox wikipedia pageBoston Red Sox Wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golfGolf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
 if o!=i:d[o]=o
 if o in d:f(i)
 try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
 except:f(i)
 print a.title()
 if t in v:k(t);print 'f';exit()
 else:f(choice(v)) if v else f(i)
f(i)

Python 373 -> 303

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
 if o!=i:d[o]=o
 if o in d:f(i)
 try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
 except:f(i)
 print a.title()
 if t in v:k(t);print 'f';exit()
 else:f(choice(v)) if v else f(i)
f(i)

Python 373 -> 303

It reads the Wikipedia destination from input() (user input) and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses one space for the indents and http://enwp.org instead of Wikipedia's full URL to save bytes.

  • -50 because if it finds a broken URL it gets a new random URL.
  • -20 because it prints the title of each URL visited (could change title -> URL, but title is cleaner and actually makes my source larger).

It hangs every once and a while, and I can't figure out why. Perhaps because of Wikipedia rate limits?

I found the Boston Red Sox Wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code Golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
 if o!=i:d[o]=o
 if o in d:f(i)
 try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
 except:f(i)
 print a.title()
 if t in v:k(t);print 'f';exit()
 else:f(choice(v)) if v else f(i)
f(i)
deleted 21 characters in body
Source Link

Python 394373 -> 324303

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
    if o!=i:d[o]=o
    if o in d:f(i)
    try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
    except:f(i)
    print a.title()
    if t in v:k(t);print 'f';exit()
    else:f(choice(v)) if v else f(i)
f(i)

Python 394 -> 324

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
    if o!=i:d[o]=o
    if o in d:f(i)
    try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
    except:f(i)
    print a.title()
    if t in v:k(t);print 'f';exit()
    else:f(choice(v)) if v else f(i)
f(i)

Python 373 -> 303

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
 if o!=i:d[o]=o
 if o in d:f(i)
 try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
 except:f(i)
 print a.title()
 if t in v:k(t);print 'f';exit()
 else:f(choice(v)) if v else f(i)
f(i)
deleted 18 characters in body
Source Link

Python 399394 -> 329324

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I don't know if it will find the page in under an hour. I haven't had an hour to try it yet. If it takes longer than the allotted time, I'll edit my script...

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(False0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
    if o!=i:d[o]=o
    if o in d:f(i)
    try:v=fromstring(a.openk(o).read()).xpath('//div[@id="content"]//a/@href')
    except:f(i)
    print a.title()
    if t in v:a.openk(t);print 'f';exit()
    else:f(choice(v)) if v else f(i)
f(i)

Python 399 -> 329

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I don't know if it will find the page in under an hour. I haven't had an hour to try it yet. If it takes longer than the allotted time, I'll edit my script...

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(False);i='http://enwp.org/Special:Random';t=input();d={}
def f(o):
    if o!=i:d[o]=o
    if o in d:f(i)
    try:v=fromstring(a.open(o).read()).xpath('//div[@id="content"]//a/@href')
    except:f(i)
    print a.title()
    if t in v:a.open(t);print 'f';exit()
    else:f(choice(v)) if v else f(i)
f(i)

Python 394 -> 324

Reads the wikipedia destination from input() (user input), and should be in the format of /wiki/dest. So, something like /wiki/Code_golf or /wiki/United_States. It also uses 1 spaces for the indents and http://enwp.org instead of wikipedia's full URL to save bytes.

  • -50 because if it finds a broken url it gets a new random url
  • -20 because it prints the title of each url visited (could change title -> url, but title is cleaner and actually makes my source larger)

It hangs every once and a while, can't figure out why. Perhaps Wikipedia rate limits?

I found the Boston Red Sox wikipedia page in 9 minutes 20 seconds, and the United States page in under 10 seconds, so it shouldn't take too long to find Code golf...

from mechanize import*;from lxml.html import*;from random import*;a=Browser();a.set_handle_robots(0);i='http://enwp.org/Special:Random';t=input();d={};k=a.open
def f(o):
    if o!=i:d[o]=o
    if o in d:f(i)
    try:v=fromstring(k(o).read()).xpath('//div[@id="content"]//a/@href')
    except:f(i)
    print a.title()
    if t in v:k(t);print 'f';exit()
    else:f(choice(v)) if v else f(i)
f(i)
deleted 18 characters in body
Source Link
Loading
deleted 66 characters in body
Source Link
Loading
added 5 characters in body
Source Link
Loading
added 20 characters in body
Source Link
Loading
Rollback to Revision 8
Source Link
Loading
no more recursion errors
Source Link
Loading
added 34 characters in body
Source Link
Loading
added 34 characters in body
Source Link
Loading
edited body
Source Link
Loading
deleted 19 characters in body
Source Link
Loading
added 171 characters in body
Source Link
Loading
deleted 54 characters in body
Source Link
Loading
deleted 4 characters in body
Source Link
Loading
Source Link
Loading