- 1

PLEASE WRITE MOVE() AND EAT() FOR GAME-------------PLEASE HELLPPPPP! (PART 2)

getDirections(t){ this.newDirections(); var found = []; for(var i in this.directions){ var x = this.directions[i][0]; var y = this.directions[i][1]; if(x >= 0 && x < matrix[0].length && y >=0 && y < matrix.length){ if(matrix[y][x] == t){ found.push(this.directions[i]); } } } return found; } mul(){ this.multiply++; if(this.multiply == 8){ var emptyCord = this.getDirections(0); var cord = random(emptyCord); console.log(cord); if(cord){ var x = cord[0]; var y = cord[1];

22nd Sep 2017, 5:06 PM
Azat
Azat - avatar
3 Answers
+ 3
I strongly recommend, that you do not make a new question for this.
22nd Sep 2017, 5:14 PM
Manual
Manual - avatar
+ 3
Please place your code, in the code playground. Then link it. paste url in comment. or press insert for app on new comment l \/
22nd Sep 2017, 5:13 PM
Manual
Manual - avatar
+ 1
Note to visitors: All 6 questions linked in 1st part, with advice to save temporary part 1 code (provided), copy code into that, link it in Q1 and don't need the rest. https://www.sololearn.com/Discuss/734595/?ref=app
22nd Sep 2017, 5:13 PM
Kirk Schafer
Kirk Schafer - avatar