Seu buggle está super-feliz! Ele acabou de encontrar o rastro verde e úmido, certamente deixado por um apetitosa e grande lesma. No seu final, o buggle tem certeza de que vai se divertir com est deliciosa lesma (representada por um baggle).
To reach that goal, you had to write a method isFacingTrail that will be called automatically by the buggle on each step. Your method should return [!python]True[/!][!java|scala]true[/!] if facing a green cell, or [!python]False[/!][!java|scala]false[/!] if not. Of course, if we are facing a wall, it should return false without bumping into it. You should make sure that this method has no side effect, i.e. that it does not change the state of the calling buggle nor of its world.
Sua ferramenta para este objetivo é o getCorDoChão()
que
retorna a cor da célula atual. Simplesmente vá para a célula que você quer
testar e execute esta função. [!java]Você não pode testar se esta cor é
igual a Cor.verde
com um símbolo de ==
mas sim
escrever algo como getCorDoChão().equals(Cor.verde)
. Isto
acontece por que verde é um objeto em Java, e .equals()
é a forma de testar igualdade entre objetos Java.[/!] [!python|scala]Então
você tem que testar se a cor retornada é igual ao valor
Cor.verde
, que representa a cor verde.[/!]
Complete o método estáDeFrenteParaRastro()
(que será chamado
automaticamente).