CodingTrain / CodingTrain/Toy-Neural-Network-JS
Cannot read property 'top' of null
- Lenguaje dominante
- JavaScript
- Estrellas
- 437
- Forks
- 242
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
When i was following along the video i got the following error:
> Uncaught TypeError: Cannot read property 'top' of null Bird.js:44
the same error as in the video but when he fixed it and i wrote the same as him i still got the error. does somebody knows how to fix this issue?
This is the code:`
let closest = null;
let closestD = Infinity;
for (let i = 0; i < pipes.length; i++) {
let d = pipes[i].x - this.x;
if(d < closestD && d > 0) {
closest = pipes[i];
closestD = d;
}
}
let inputs = [];
inputs[0] = this.y / height;
inputs[1] = closest.top / height;
inputs[2] = closest.bottom / height;
inputs[3] = closest.x / width;
let output = this.brain.predict(inputs);
if(output[0] > 0.5) {
this.up();
}
`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start at Bird.js:44 and trace the pipes loop before the inputs are assembled. Reproduce the tutorial state where no pipe is selected, then verify the prediction path can run without the null-property error. Done means the reported TypeError no longer occurs during the game.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- game-dev
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100