Skip to content

Commit 288bcbb

Browse files
Update main.js
1 parent 0d2076e commit 288bcbb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

js/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ function loop() {
135135
} else {
136136

137137
// random number between 0 and 1
138-
// if the random number is less than 0.4, add the input to the training data
139-
if (Math.random() < 0.4) {
138+
// if the random number is less than 0.35, add the input to the training data
139+
if (Math.random() < 0.35) {
140140
trainingData.push({
141141
input: {
142142
apple_x: apple.x / canvas.width,
@@ -167,10 +167,11 @@ function loop() {
167167
// count frames
168168
training_count++
169169

170-
// train the network every 50 frames
171-
if (training_count === 50 || first_time) {
170+
// train the network every 25 frames
171+
if (training_count === 25 || first_time) {
172172
first_time = false
173173
network.train(trainingData)
174+
console.log(`trainingData: ${trainingData.length}`)
174175
training_count = 0
175176
}
176177

0 commit comments

Comments
 (0)