Skip to content

Commit 0d2076e

Browse files
Update main.js
1 parent 5479508 commit 0d2076e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

js/main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ function loop() {
153153
tail_down: (snake.cells[0].y + grid) / canvas.height
154154
},
155155
output: {
156-
up: 0,
157-
down: 0,
158-
left: 0,
159-
right: 0
156+
up: Math.random(),
157+
down: Math.random(),
158+
left: Math.random(),
159+
right: Math.random()
160160
}
161161
})
162162
}
@@ -167,8 +167,8 @@ function loop() {
167167
// count frames
168168
training_count++
169169

170-
// train the network every 40 frames
171-
if (training_count === 40 || first_time) {
170+
// train the network every 50 frames
171+
if (training_count === 50 || first_time) {
172172
first_time = false
173173
network.train(trainingData)
174174
training_count = 0

0 commit comments

Comments
 (0)