hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Automatic submitting

 
Reply to topic    hacker.org Forum Index » General Puzzles View previous topic
View next topic
Automatic submitting
Author Message
klavierspieler21



Joined: 13 Jul 2007
Posts: 16
Location: Waterloo

Post Automatic submitting Reply with quote
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
Wed Dec 10, 2008 5:07 am View user's profile Send private message
Karian



Joined: 09 Jan 2008
Posts: 75

Post Reply with quote
check out the bricolage forum. There is a sample program posted in python. If you prefer java, you can find one in mortal coil. Maybe some other languages can be found, if you use the search function of the forum.
Wed Dec 10, 2008 9:15 am View user's profile Send private message
klavierspieler21



Joined: 13 Jul 2007
Posts: 16
Location: Waterloo

Post Reply with quote
yeah i tried going through the python script, but i couldn't figure out how to extract the "get and submit" part of it.

can someone be kind enough to explain the gist of it?
Wed Dec 10, 2008 11:40 pm View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
If you don't care about error handling and things like cookies, then it's pretty simple:

Code:

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()


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.
Thu Dec 11, 2008 1:17 am View user's profile Send private message
klavierspieler21



Joined: 13 Jul 2007
Posts: 16
Location: Waterloo

Post Reply with quote
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 Razz

oh and btw this site is amazing.
cheers to everyone
Thu Dec 11, 2008 2:59 am View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » General Puzzles All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.