CodingTrain / CodingTrain/Toy-Neural-Network-JS
Cannot read property 'top' of null
- 主要言語
- JavaScript
- スター
- 437
- フォーク
- 242
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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();
}
`
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Bird.js:44 から始め、inputs が組み立てられる前の pipes ループを追跡します。pipe が選択されていないチュートリアルの状態を再現し、その後、null-property エラーなしで prediction パスを実行できることを確認します。ゲーム中に報告された TypeError が発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- game-dev
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100