An implementation of the particle swarm optimisation algorithm written in P5.js.
Currently the global optima is (width/2, height/2). This needs to be replaced. Since each particle shouldn't be aware of the global optima, the approach is intrinsically flawed.
A loss function needs to be implemented where. Gradient descent for example, with random seed data. The particle best needs to be calculated by taking a step in any of the directions that incurs the least loss.