Conversation
Update dev_maribel with master
| } | ||
| } | ||
|
|
||
| function setup(squareSize, initialPosition, instructions) { |
There was a problem hiding this comment.
Aunque igual sería interesante hacer una validación de los parámetros.. para evitar sorpresas al ser tan extraña la forma de pasarnos los argumentos
| machine.instructions = instructions; | ||
| } | ||
|
|
||
| function start() { |
There was a problem hiding this comment.
Bravo! Muy bien conectado y coherente con respecto a machine 👌
| initialPosition = initialPosition.split(" "); | ||
| machine.position.x = parseInt(initialPosition[0]); | ||
| machine.position.y = parseInt(initialPosition[1]); | ||
| machine.state = initialPosition[2]; |
There was a problem hiding this comment.
Igual heading sería más correcto que state como nombre 👍
|
|
||
| ```javascript | ||
| var machine = { | ||
| squareSize: 5, |
There was a problem hiding this comment.
No pondría valores por defecto...
| } | ||
|
|
||
| function start() { | ||
| machine.executeInstructions(); |
There was a problem hiding this comment.
Sería interesante validar el estado d ela maquina antes de inicializar la marcha...
| }, | ||
|
|
||
| executeInstructions() { | ||
| this.instructions.forEach(instr => { |
There was a problem hiding this comment.
No se gestionan los posibles errores en la secuencia. P.j.. que se salga del mapa o similares
| changePositionTo(newX, newY) { | ||
| var newXIsValid = (newX >= 0 && newX < this.squareSize); | ||
| var newYIsValid = (newY >= 0 && newY < this.squareSize); | ||
| if (newXIsValid && newYIsValid) { |
There was a problem hiding this comment.
Muy bien la gestión de errores! 🌟
Merge master into dev_maribel
No description provided.