Hedgemaze: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{ #vardefine:name|hedgemaze}}{{ #vardefine:return_type|boolean}}{{ FunctionPage| name={{#var:name}}| function_category=Adventuring| function1={{Function| name={{#var:name}}| a…' |
imported>Bale Use that code frequently, so might as well just paste it in! |
||
Line 16: | Line 16: | ||
function_description=Attempts to complete the hedge maze puzzle and returns its success.| | function_description=Attempts to complete the hedge maze puzzle and returns its success.| | ||
code1={{CodeSample| | |||
title=Hedging| | |||
description=A complete program that solves the Hedge Maze, killing as many hedge golems as necessary to get mazes and counting the turns used.| | |||
code= | |||
<syntaxhighlight> | |||
boolean hedging() { | |||
boolean success = false; | |||
int maze_trips = 0; | |||
while(my_adventures() > 0 && !success) { | |||
if(item_amount($item[hedge maze puzzle]) == 0) { | |||
adventure(1, $location[hedge maze]); | |||
maze_trips = maze_trips + 1; | |||
if(maze_trips > 1) | |||
print("Entered the Hedge Maze "+ maze_trips + " times."); | |||
else | |||
print("Entered the Hedge Maze once."); | |||
} | |||
if(item_amount($item[hedge maze puzzle]) > 0) | |||
success = hedgemaze(); | |||
} | |||
return success; | |||
} | |||
void main() { | |||
if(!contains_text(visit_url("lair3.php"), "lair4.php")) | |||
hedging(); | |||
print("Hedge Maze solved!", "green"); | |||
} | |||
</syntaxhighlight>}}| | |||
see_also={{SeeAlso|chamber|entryway|guardians|tavern}}| | see_also={{SeeAlso|chamber|entryway|guardians|tavern}}| |
Revision as of 20:02, 10 March 2010
Function Syntax
boolean hedgemaze()
Attempts to complete the hedge maze puzzle and returns its success.
Hedging
A complete program that solves the Hedge Maze, killing as many hedge golems as necessary to get mazes and counting the turns used.
boolean hedging() {
boolean success = false;
int maze_trips = 0;
while(my_adventures() > 0 && !success) {
if(item_amount($item[hedge maze puzzle]) == 0) {
adventure(1, $location[hedge maze]);
maze_trips = maze_trips + 1;
if(maze_trips > 1)
print("Entered the Hedge Maze "+ maze_trips + " times.");
else
print("Entered the Hedge Maze once.");
}
if(item_amount($item[hedge maze puzzle]) > 0)
success = hedgemaze();
}
return success;
}
void main() {
if(!contains_text(visit_url("lair3.php"), "lair4.php"))
hedging();
print("Hedge Maze solved!", "green");
}
CLI Equivalent
The CLI command "entryway" will perform the same tasks.
See Also
Attention KoLmafia Experts!
We need your help; some details of this function's operation are unknown or unclear.
The following specific question has been raised:
- Does this function complete the entire maze (both getting the key and getting the exit)?