xxxxxxxxxx
22
//esversion: 8
let ball;
function setup() {
createCanvas(400, 400);
ball = new Ball(cost);
train(2);
}
function draw() {
background(220);
ball.show();
}
function cost(x, y) {
return dist(x, y, 400, 400);
}
async function train(learnRate) {
while (!cost <= 2) {
ball.learn(learnRate);
}
}