Cavern Master
-
- Posts: 20
- Joined: Mon Jun 20, 2011 6:25 pm
Writing a Bot
Well, iv never done any code before relating to internet.
Iv used python for alot of the challenges but with this i have no idea where to start
a google suggested urllib2 but with the below I got a 'not logged in'
import urllib2
response = urllib2.urlopen('http://www.hacker.org/challenge/misc/d/cavern.php')
html = response.read()
print html
so i tried adding &name=General_Payne&password=[mypassword] to the url. Errored out.
Any clues / how to submit, what to do would be much appreciated
Iv used python for alot of the challenges but with this i have no idea where to start
a google suggested urllib2 but with the below I got a 'not logged in'
import urllib2
response = urllib2.urlopen('http://www.hacker.org/challenge/misc/d/cavern.php')
html = response.read()
print html
so i tried adding &name=General_Payne&password=[mypassword] to the url. Errored out.
Any clues / how to submit, what to do would be much appreciated
For the first parameter you would have ? instead of & e.g. .../cavern.php?name=General_...
You may also have to urlencode your password which can be done in python with something likeurlllib2 doesn't have a urlencode function so you have to get it from urllib instead
You may also have to urlencode your password which can be done in python with something like
Code: Select all
from urllib import urlencode
encodedPassword = urlencode( "!@#$%^&*()_+ oh no my password" )
query = "/challenge/misc/d/cavern.php?name=General_Payne&password=%s"%encodedPassword
-
- Posts: 20
- Joined: Mon Jun 20, 2011 6:25 pm
Reply
Thanks alot Codex
Id just managed to figure out how to do it before checking this again. Now my issue is my damn bot refuses to go down stairs its i the top left or bottom right square, but thats just a code error.
Iv rewritten it from scratch twice and get the same issue so im being rather dim somewhere lol
Id just managed to figure out how to do it before checking this again. Now my issue is my damn bot refuses to go down stairs its i the top left or bottom right square, but thats just a code error.
Iv rewritten it from scratch twice and get the same issue so im being rather dim somewhere lol
-
- Posts: 4
- Joined: Wed Jul 20, 2011 9:04 pm
# My current level: 128 (4883 XP)
# dungeon level: 123
# HP: 2640
# Weapon: Level 122 Slicer +5 (Strength: 127)
# Inventory: Aquamarine potion +4, Aquamarine potion +5, Magenta potion +4
I hope it will summon soon...
edit: Never mind, I got it That was easy ... hat more than 2000 HP and the +5 heal potion left.
# dungeon level: 123
# HP: 2640
# Weapon: Level 122 Slicer +5 (Strength: 127)
# Inventory: Aquamarine potion +4, Aquamarine potion +5, Magenta potion +4
I hope it will summon soon...
edit: Never mind, I got it That was easy ... hat more than 2000 HP and the +5 heal potion left.
I really enjoyed this challenge since I haven't written a bot like this before. I used ruby with the mechanize gem to complete this, and although my script wasn't perfect it did the job of killing the boss with ease. Funnily enough even the logging in to start the game was a challenge since it took me a little while to figure out how to use mechanize since the examples in the docs weren't great.
Great Challenge
The first bot I wrote.I used python and splinter, but my bot needed some time. At the end I was scared whether the bot win or not so I did it myself. I was 14 levels above the dungeon level drank a magenta potion +5 and killed the boss with one hit. My bot needed a week in the 24 hours a day mode to be all the time between 14 and 20 Levels above the dungeon level. Maybe not the best bot x)
Re: Great Challenge
So Cave Master would be challenging . Funny, it's exactly 2 years I have solved it.Kaaser wrote:The first bot I wrote.I used python and splinter, but my bot needed some time. At the end I was scared whether the bot win or not so I did it myself. I was 14 levels above the dungeon level drank a magenta potion +5 and killed the boss with one hit. My bot needed a week in the 24 hours a day mode to be all the time between 14 and 20 Levels above the dungeon level. Maybe not the best bot x)
Re: Great Challenge
sorry i am laughing XDHippo wrote:So Cave Master would be challenging . Funny, it's exactly 2 years I have solved it.Kaaser wrote:The first bot I wrote.I used python and splinter, but my bot needed some time. At the end I was scared whether the bot win or not so I did it myself. I was 14 levels above the dungeon level drank a magenta potion +5 and killed the boss with one hit. My bot needed a week in the 24 hours a day mode to be all the time between 14 and 20 Levels above the dungeon level. Maybe not the best bot x)
-
- Posts: 1
- Joined: Tue Aug 23, 2016 12:04 am
-
- Posts: 1
- Joined: Mon Oct 27, 2008 1:26 pm