Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NASA rover challenge #50

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

NASA rover challenge #50

wants to merge 11 commits into from

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.

2 participants