[Adventurer] Ice Hunter


#1

Mountain level Ice Hunter is ready for testing.

It’s a demo level about substring search with Naïve string search algorithm.


#2

I failed this level with Hardened Steel Glasses (range 25m), but I succeeded after I changed it to Twilight Glasses (range infinity).


#3

Ha?! It’s interesting. I disabled “checkVisionLine” for this level. Could you send me the sessionID for the failed example? (Open dev console and look for a string with sessionID)


#4

I just tried this level again with Hardened Steel Glasses and it succeeded :see_no_evil::see_no_evil::see_no_evil:
Previously Anya only attacks 3 yaks and the loop gets stuck there before she can attack Gildbosa. I even do hero.say on who she’s attacking. It was a bit frustrating & finally an idea occurred to me that maybe she doesn’t see Gildbosa because it’s out of her range, so I changed the glasses.

So just to make sure, that was a bad seed right? I’ll keep in mind to try changing my armor if it happens again (that seems to reset the seed).


#5

I think you played old version (it can be cached some time). So if it works now, then it’s ok. Thank you for your time.


#6

@Bryukh with an upgrade to my sword I was able to complete this level using the gear I had at that level.


Not all of the programming concepts are showing up:


added LUA patch
added Grammar patch


#7

I think it’s still in experiment phase (about new concepts)


#8

When I type my code, it says Line 7: TypeError: Cannot read property ‘length’ of undefined.
Is this my error or an error with the sample code?


#9

Hunt for 4 yaks. Choose only the small ones.

Small yak names contain a “bos” substring.

This function checks if a word contains a substring.

def isSubstring(word, substring):
# We iterate through the start indexes only.
rightEdge = len(word) - len(substring)
# Loop through the indexes of the word.
for i in range(rightEdge + 1):
# For each of them loop through the substring
for j in range(len(substring)):
# Use an offset for the word’s indexes.
shiftedIndex = i + j
# If letters aren’t the same:
if word[shiftedIndex] != substring[j]:
# Check the next start index in the word.
break
# If it was the last letter in the substring:
if j == len(substring) - 1:
# Then the substring is in the word.
return True
# We haven’t found the substring in the word.
return False

Loop through all enemies.

enemies = hero.findEnemies()
for e in range(len(enemies)):
enemy = enemies[e]
# Use the function isSubstring to check
# if an enemy name (id) contains “bos”:
if isSubstring() is True:
hero.attack(enemy)
# Then defeat it.


#10

if you attack
Yaks, Yeti
with

hero.cast( "drain-life", enemy )

they are not fighting back


#11

Thanks. I added an issue about it.