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
like a tool, lets say a screwdriver.
The function it self
is the handle. I determine if it’s green or red etc.
The parameter on the other hand, the text inside the ( and )
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
And this is what I don’t understand.
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
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