Hello everybody,
first of all I want to say that I do not need help to solve the level.
It’s just that I don’t understand the logic behind the introduced and hinted function in the level Blackwoods Fork.
So the description when you start the level and also the hints page say:
# This function has 1 parameter: 'target':
def checkAndAttack(target):
# 'target' is a predefined variable.
if(target):
hero.attack(target)
I see the
def checkAndAttack(target):
like a tool, lets say a screwdriver.
The function it self
checkAndAttack():
is the handle. I determine if it’s green or red etc.
The parameter on the other hand, the text inside the ( and )
target
is the tip of the screwdriver and I determine if it’s a Philip’s or a flat-tip one.
So far so good.
Now in the example/hint we predefine the ‘target’ variable as
if(target):
hero.attack(target)
And this is what I don’t understand.
We say
hero.attack(target)
IS the meaning of ‘target’ (the variable) but with ‘(target)’ we crate something that makes no sense.
To me this says somethinge like “Tomato is Tomato”. This describes not WHAT a Tomato is.
A description of Tomato would be more like “A tomato is the fruit of a plant that contains its seeds and various nutrients, as well as water.”
So how does the game know the difference between
checkAndAttack(**target**):
and
hero.attack(**target**)
and why doesn’t create this an infinit loop or something?
I hope this makes any sence to you and somebody understands the way I think and why I’m curious about that
Cheers
lynx85