hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
problem in automating the puzzle

 
Reply to topic    hacker.org Forum Index » Runaway Robot Puzzle View previous topic
View next topic
problem in automating the puzzle
Author Message
bodjo



Joined: 26 Feb 2011
Posts: 37
Location: tunisia

Post problem in automating the puzzle Reply with quote
hi guys i have already create a python solver for this puzzle but the only problem is i don't know how to get values from variables in the site
i think i need some help Rolling Eyes
Mon Jun 06, 2011 5:05 pm View user's profile Send private message
uws8505



Joined: 23 Jan 2011
Posts: 32

Post Reply with quote
Simply pick a simple level (possibly level 0) and take a look into its source code.
You can find everything about the puzzle shown on the page in the source code.
Also, don't try to figure out the line number where the problem values, but rather a keyword where the problem values are in the same line. This way, the program is guaranteed to obtain the problem values, and the code is also quite simple in Python.

Personally I did beat this with C++ when I didn't know Python, but copy-pasting the problem every time to notepad was really a pain...
Mon Jun 06, 2011 5:18 pm View user's profile Send private message
bodjo



Joined: 26 Feb 2011
Posts: 37
Location: tunisia

Post Reply with quote
yes but i want from the solver to automaticly do that
Mon Jun 06, 2011 5:24 pm View user's profile Send private message
laz0r



Joined: 04 Feb 2010
Posts: 290
Location: Within the depths of Unix

Post Reply with quote
You can use various string manipulation functions to spot the variables automatically. Import the page, cut out the bits you don't need, parse the bits that are left.

_________________
There is no spoon.
Mon Jun 06, 2011 5:49 pm View user's profile Send private message
bodjo



Joined: 26 Feb 2011
Posts: 37
Location: tunisia

Post Reply with quote
good idea Laughing
thank you
Mon Jun 06, 2011 5:51 pm View user's profile Send private message
virus171



Joined: 10 Jul 2010
Posts: 4
Location: Australia

Post Reply with quote
Hi guys. With regards to automation, I have been able to extract all of the useful information from the source code, but when it submits the answer, I am always told that my answer sucked. I check my solution with the string representing the layout of the map obtained from the source code and find no problem.

Just wondering what I am doing wrong and how to fix it
Wed Jun 08, 2011 11:42 am View user's profile Send private message
MrTerry



Joined: 26 Jan 2010
Posts: 33

Post Reply with quote
well could be anything.....
since it tolds u that ur solution sucked means ur locked in.... so there must be something within the solution itself....could u show an example url u would use ?

_________________
Runaway Robot LvL 452
path: DDDRDRDDRRDDRRDRRRDDRRRRDDDRRDDDRRDRDRDRDRRRRRDRRDRRRRRDDRRDDDDRDRRRDRRDDRDRDRRRRRDRDDDRDDRDRRRRDDDDDDRRRRRRR

boom at 1 1
your solution sucked

Oo wtf?
Wed Jun 08, 2011 9:58 pm View user's profile Send private message
megabreit



Joined: 03 Jan 2009
Posts: 141

Post Reply with quote
You need to save the session cookie and use it when posting the result!
Otherwise you get a different level each time... and the solution for the old level sux all time Smile
Fri Jun 10, 2011 12:42 am View user's profile Send private message
virus171



Joined: 10 Jul 2010
Posts: 4
Location: Australia

Post Reply with quote
Thanks for the replies
Would you be able to tell me how i would do that in python? I don't have very much (any) experience in doing this sort of thing. I did a search, but I'm not exactly sure what's needed.
Fri Jun 10, 2011 5:13 am View user's profile Send private message
megabreit



Joined: 03 Jan 2009
Posts: 141

Post Reply with quote
I can tell you how this works in perl:
Code:
my $request = HTTP::Request->new(GET => "http://www.hacker.org/runaway/index.php?name=$user&password=$password");
$ua=LWP::UserAgent->new;
$response = $ua->request($request);
$session=$response->header("Set-Cookie");

[...] and later on:
my $header=HTTP::Headers->new;
$header->header('Set-Cookie' => $session);
my $request = HTTP::Request->new(GET => "http://www.hacker.org/runaway/index.php?name=$user&password=$password&path=$path",$header);
It's probably very similar in python... check the online doc Smile
Fri Jun 10, 2011 5:48 pm View user's profile Send private message
virus171



Joined: 10 Jul 2010
Posts: 4
Location: Australia

Post Reply with quote
Thanks for your help. Smile I'll see if I can get it working with this

EDIT: Thanks to your info, got it working! Very Happy Now lets see how far i get with this basic solver
Sat Jun 11, 2011 2:39 am View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Runaway Robot Puzzle 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.