Skip to content

Instantly share code, notes, and snippets.

@adamatti
Last active Nov 1, 2019
Embed
What would you like to do?
Resultado DOJO de node - 20/04/2017 #dojo
const assert = require('assert')
it ("primeiro caso - R2", () => {
assert.equal ( pula('R2') , 2 )
})
it ("segundo caso - R3", () => {
assert.equal ( pula('R3') , 3 )
})
it ("caso - dois pulos R3 R4", () => {
assert.equal ( pula('R3, R4') , 7 )
})
it ("caso - tres pulos direita R2 R2 R2", () => {
assert.equal ( pula('R2, R2, R2') , 2 )
})
function pula(comandos){
var comando = comandos.split(',')
var x = 0
var y = 0
var distanciaFinal = 0
for(var i = 0; i < comando.length; i++) {
distanciaFinal += parseInt(comando[i].trim().substr(1))
}
return distanciaFinal
}
function identificaDirecao (direcao) {
if(direcao == "R") {
} else {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment