follow the chain
This challenge has a link that goes to ;
and it tells you that ‘the next nothing is 92512’. So the challenge is to enter the each nothing in order to return the next nothing. Easy enough, till they throw you a couple of challenges a few dozen nothings in. After adjusting the script a couple of times I ended up with;
#!/usr/bin/ruby nothing = 12345 url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=" require 'open-uri' while nothing > 0 nNothing = open(url + nothing.to_s).read puts nNothing if nNothing.split(" ") == "Divide" nothing /= 2 else nothing = nNothing.split("nothing is ").to_i end end
I started out using regex to grab the numbers, but they quickly nix that method.
Next challenge 5; Peak Hell