Hi,
I'm new to programming. In fact I just took my first introductory class this semester in Scheme at U. of Waterloo.
I wrote a small quasi brute force for Runaway Robot, but I don't know how to write something that will automatically get and submit my answers.
Anybody can give me an example/teach me in Python or Scheme?
Thanks
Automatic submitting
-
- Posts: 16
- Joined: Fri Jul 13, 2007 12:21 am
- Location: Waterloo
-
- Posts: 16
- Joined: Fri Jul 13, 2007 12:21 am
- Location: Waterloo
If you don't care about error handling and things like cookies, then it's pretty simple:
In each case, "page" will be a string containing all the content sent back by the server. You'll need to parse it a bit to extract the FlashVars strings.
For later levels you sometimes need to submit with POST rather than GET as above, but GET will be fine initially.
Code: Select all
import urllib2
# Fetch a page
page = urllib2.urlopen('http//www.hacker.org/...').read()
# Oops, needed to provide login details
page = urllib2.urlopen("http://www.hacker.org/...?name=klavierspiel21&password=XXX").read()
# or use the "spw" system to avoid sending your password all the time
# Same for submitting solutions:
page = urllib2.urlopen("http://www.hacker.org/...?x=5&y=2&path=ULULDLURDRD").read()
For later levels you sometimes need to submit with POST rather than GET as above, but GET will be fine initially.
-
- Posts: 16
- Joined: Fri Jul 13, 2007 12:21 am
- Location: Waterloo
wow thanks o.O
i'm learning so much here its incredible...
i'll play around to get familiar with this..
right now i'm working on an efficient Runaway algorithm (still in scheme though...). if its actually as good as i'm thinking it is, it should get me up to 513 like all of you up there
oh and btw this site is amazing.
cheers to everyone
i'm learning so much here its incredible...
i'll play around to get familiar with this..
right now i'm working on an efficient Runaway algorithm (still in scheme though...). if its actually as good as i'm thinking it is, it should get me up to 513 like all of you up there
oh and btw this site is amazing.
cheers to everyone