#Go#Raylib#Machine learning#Perceptron
Flappy Bird Machine Learning

February 24th, 2025
go
// Take the matrix, and do a forward pass through the weights
func (nn *NeuralNetwork) Predict(inputs []float64) float64 {
// Go through the hidden layer and sum the weights
hidden := make([]float64, nn.HiddenSize)
for i := range nn.HiddenSize {
sum := 0.0
for j := range nn.InputSize {
sum += inputs[j] * nn.Weights1[j][i]
}
hidden[i] = sigmoid(sum)
}
// Computer output layer activation
output := 0.0
for i := range nn.HiddenSize {
output += hidden[i] * nn.Weights2[i][0]
}
// Probability of flapping
return sigmoid(output)
}