Skip to content

Instantly share code, notes, and snippets.

@SergProduction
Last active August 14, 2016 14:29
Show Gist options
  • Save SergProduction/fee6695b429fc2efe2cc19bb1ac25988 to your computer and use it in GitHub Desktop.
Save SergProduction/fee6695b429fc2efe2cc19bb1ac25988 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Neuron</title>
</head>
<script>
let save = 0;
const a5 = [0,0,1,1]; //типо цифра 5 (воображаемая)
let weight = [0,0,0,0]; //веса каждого синапса
let mul = [];
let sum = 0;
function start(){
// Пробегаем по каждому аксону
for (let i = 0; i < 4; i++) {
mul[i] = weight[i] * a5[i]
}
console.log('mul',mul);
for (let i = 0; i < 4; i++) {
sum+= mul[i];
}
console.log(sum);
}
start();
function no(){
for (let i = 0; i < 4; i++) {
weight[i]-= a5[i];
}
start()
}
function yes(){
for (let i = 0; i < 4; i++) {
weight[i]+= a5[i];
}
start()
}
</script>
<body>
<button onclick="no()">не правильно</button>
<button onclick="yes()">верно</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment