Skip to content

Conversation

@minicatsCB
Copy link
Collaborator

No description provided.

@UlisesGascon UlisesGascon mentioned this pull request Jan 9, 2019
46 tasks
}
}

function setup(squareSize, initialPosition, instructions) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buen enfoque!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Igual heading sería más correcto que state como nombre 👍


```javascript
var machine = {
squareSize: 5,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No pondría valores por defecto...

}

function start() {
machine.executeInstructions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sería interesante validar el estado d ela maquina antes de inicializar la marcha...

},

executeInstructions() {
this.instructions.forEach(instr => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy bien la gestión de errores! 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants