AI algorithms for JavaScript