Call function

this[shapes[currentShape]]();

Meaning:
shapes is array of function.
exp: shapes[currentShape] = "drawingLine"
so it mean drawingLine();

Object Name

this['ship' + i]

Meaning:
this is current object. there object named ship1, ship2, ship3, ship4
so in for loop, when i = 2 , it means calling to object ship2.