7lines ping-pong LUA -- is it possible to do 6?

So, using LUA I can get the ping-pong challenge to 7lines, have messed with the findNearestEnemy() but that doesnt seem to work in this challenge. I pulled the tip from the hints but with LUA currently I only have the following methods available:
while-true loop

The while-true loop is being used but still only able to get 7 lines because i need to duplicate the move to go back and forth and have not found a way to have two actions on 1 line. Is this one even possible to do in 6 lines in LUA?

Welcome to the forum! This is a family-friendly place where coders can share bugs, ask for help on any CodeCombat level (don’t forget to post your code correctly), or just hang out with other coders. But before you proceed, please check out our guidelines: this topic.
Have a great time! :partying_face:

Welcome to the forum :partying_face:, can you please post your code so we can help you? And don’t forget to format it with this button: </>


I know almost nothing about lua but after a few trials and errors I managed to fit the code in 6 lines

steps = -3
while ( true ) do
   -- attack first ball
   -- attack second ball
   hero:moveRight( steps = -steps)

Hm interesting , so that is flipping the -3 to +3 with the -steps. didnt know you could do that, as that isnt one of the things taught in the previous stepping stones. Was trying to use all the hints and given information in the methods and nothing was mentioned about that. Unless i just read it wrong/ interpretted it wrong.

1 Like