background preloader

Artificial intelligence

Facebook Twitter

JavaScript « Travis V. Anderson. For my optimization class last semester, I built an entire chess game using HTML and JavaScript.

JavaScript « Travis V. Anderson

I also wrote an artificial intelligence algorithm to play as a computer player. My algorithm has about 20 different parameters it uses to score each move and decide which move it should take. For my optimization class project, I then wrote a real-value genetic algorithm with to optimize these 20 parameters to find the “best” settings for the computer player. My algorithm here only does a two-ply (easy setting) or a three-ply (hard setting) search. With more computing power, this could be increased to improve the “skill” of my computer player. There are still a few small bugs that need to worked out (castling sometimes doesn’t work properly, en passant isn’t possible, and a stalemate is treated as a checkmate). Click here to play a live demo! (Of course, this game is fastest in Chrome, and awfully slow in Internet Explorer. Artificial intelligence network load balancing using Ant Colony Optimisation.

Download source code - 791 KB Introduction Ants first evolved around 120 million years ago, took form in over 11,400 different species, and are considered one of the most successful insects due to their highly organised colonies, sometimes consisting of millions of ants.

Artificial intelligence network load balancing using Ant Colony Optimisation

One particular notability of ants is their ability to create "ant streets". Long, bi-directional lanes of single file pathways in which they navigate landscapes in order to reach a destination in optimal time. These ever-changing networks are made possible by the use of pheromones which guide them using a shortest path mechanism. Computer scientists began researching the behaviour of ants in the early 1990's to discover new routing algorithms. This article details how ACO can be used to dynamically route traffic efficiently. Background Electronic communication networks can be categorised as either circuit-switched or packet-switched.

A number of techniques can be employed to optimise the flow of traffic around a network. Optical Character Recognition with JavaScript. The HTML5 (touch device enabled) Javascript application that you see below implements basic Optical Character Recognition using simple Euclidean Distance comparisons.

Optical Character Recognition with JavaScript

To make use of this example draw a digit in the large rectangle below. Click the "Recognize" button and the program will attempt to guess what digit you drew. The accuracy is not perfect, but it does do a reasonably good job. The program is already trained with the digits. You can remove any of these digit entries, or create your own. You will notice that anything that you draw is first cropped, and then downsampled. This example shows how Javascript can be used to perform basic Optical Character Recognition. JavaScript Machine Learning and Neural Networks with Encog. Download heaton-javascript-ml.zip - 45.1 KB Introduction In this article you gain a basic understanding of how to use some Machine Learning topics in Javascript.

JavaScript Machine Learning and Neural Networks with Encog

I will use the Encog framework. I will show you how to use Encog objects to accomplish Optical Character Recognition, , Simulated Annealing, Genetic Algorithms, and Neural Networks. Encog also includes several GUI widgets that make it easy to display the output from common machine learning tasks. Background Encog is an advanced Machine Learning platform for Java, C#, Javascript, and C/C++. Using the Code All of the examples covered in this article can be found in the accompanying download. This code is also hosted at the following GitHub repository. You can see all of the examples covered in this article running live at the following URL: The Encog framework is contained in two Javascript files.

Euclidean Distance We will start by looking at Euclidean Distance. Array 1: [ 1, 2, 3] Array 2: [ 1, 3, 2] Array 3: [ 3, 2, 1] Flocking.