Spud Ai

Spud Ai is a computer program that is an attempt to create artificial intelligence (AI). The program is built by taking my understanding of "the mind" and turning that understanding into a computer program. The program is also a practical tool and is used for numerous tasks in my everyday life.

Wikipedia describes Artificial intelligence (AI) as the intelligence exhibited by machines or software, and the branch of computer science that develops machines and software with intelligence. Major AI researchers and textbooks define the field as "the study and design of intelligent agents",[1] where an intelligent agent is a system that perceives its environment and takes actions that maximize its chances of success.[2] John McCarthy, who coined the term in 1955,[3] defines it as "the science and engineering of making intelligent machines.

The Spud Ai's basic function is to process information in an intelligent manor and respond accordingly. It has numerous processing functions and algorithms that act on information in different ways most of these are language based which gives the Ai the ability to work as a chat bot. There is a main database called the Brain Database (BD), entries in the BD are called Cells. A cell can either hold information or it can be 'activated', when activated the cells neural network takes the input code, processes it through the network and produces the output code. How the input code is processed and the output it produces is dependant on how the network has been trained. The output nodes can be connected to other cells input nodes, the Tag field is also used to control how the output is used. As the Ai evolves the BD grows in size.

When used as chat bot the language processes take the input and process it in different ways. The majority of these processes come from flashes of inspiration. Whether these inspirational bits of code form some sort of mind or produce replies that show some form of intelligence only time will tell, as these work by forming connections that evolve as the Ai builds up its data base. Data is inputted manually or by the various learning processes (LM). Learning processes add data which is then worked on by the various processes, this gives the Ai the ability to output correct information without having being told about the specific subject but from associations only. Other processes are designed to give specific answers to specific questions or use some of the input in the output.

The Ai is packed full of functions which gives the Ai the ability to perform many practical tasks. As the Ai evolves more functions are added. Keywords associated to a cell word are used for many of the functions. Cells 800 to 2000 are know as system cells these are used by the various functions and processes including various input output devices from hardware to networking. Cell 2000 and upward are used for data storage like words and patterns.

The things the Ai can be used for is an ever growing list, its designed to be flexible in usage. There are functions within the Ai that are there because i've needed software to do a certain task. Instead of creating a new program i just add a new function to the Ai.

Here is a list of things i use the Ai for: searching indexed files for information, working as a chat bot on a web page, creating price list information for my company web site, indexing job files for my companies database, taking a picture of my solar controller and sending it to the web server, playing music, controlling relays in my house, monitoring and controlling power distribution from my renewable energy systems, object recognition for the robot mapping functions, controlling a robot, quick information like finding out tomorrows weather and the main news story and talking to.

The Ai is designed to do things i haven't even thought of.

The program is under constant test and runs for long periods of time it is designed to be as stable as possible, there are some functions that monitor program stability and react if any problems are found, either by fixing the problem automatically or by alerting the user.

The programs main input is text words which can be generated by voice to text programs, network messages, text files, keyboard, web page form etc. There is also ways of inputting data directly into the neural network.

The input is processed by the program and then it produces an output which could be to run a script, program, create a web page send a message through a network, create a sentence, activate the neural network.

The answer is created according to how the input is translated using various functions within the program which use information in the Brain Database.

The Ai program is available as a free download as long as you accept and agree to the following:
We take no responsibility for any consequences that may occur from using the program.
You must not train the Ai to break its own law, know as Robot Law which is a text file and is part of the download.
You must not disassemble the program in any way.
You may use, pass on, redistribute as you like as long as you don't remove any copyright notices. If you pass the program on you must make sure you also supply the link to this page.

The documentation may be unclear or at times confusing, this situation will change over time as the project develops.
© 2004 - 2015 Piet Defoe

Click here to download Spud Ai

Latest version: AiV016m
Last update: 17-11-2015

The Ai is running periodically on a server, the link bellow will connect you to the Ai if the server is on

Spud Ai at etowns.net During the winter months the server is on intermittently.

Robot pages

Yorkshire Robot Company

This update has a couple of new Emotion functions. One of these gives the Ai the ability to asses if the inputted sentence is framed in a positive or negative way. The other function is a Word Swopper (WS). This changes nouns and verbs in the input. Some new Keywords have been added. Some older functions have been removed this is because there are other ways of doing the same thing. If anything disappears that you use then please let me know and i'll send details of how to do the function in other ways.

A new version, this version has a new process called Sentence Types (ST). This process is based on latest brain research which talks about a Formula Of Language (FOL). Some words are given a code called a ST code, in a similar way to word types but not all words are assigned a code and a word could have more than one code. A number of codes are setup by the SuffixFind keyword. ST code meanings are structured around the requirements for the FOL. Normal word types are the traditional types like nouns and verbs, ST codes use some of these. The number of ST codes is kept as low as possible to reduce the complexity of he FOL, unlike normal word types which, when used by pattern recognition works better the more different types there are. The ST process is working very well even though the FOL is still under development and not yet fully functional.
The robot arm is built and working a video of it moving a beer can, can be seen here.
This version has some new keywords, tags and the help file has been worked on.
The output filter now has a Grammar filter. This is designed to re-order words into correct english. Outputs produced by processes that use neural networks tend to produce a sting of words relevant to the conversation but spat out in a jumbled manor. The grammar filter re-orders and excludes words. This filter when run in reverse turns normal language into an output that sounds like something Yoda from Star Wars would say!
ImageScanFunctions now include movement detection and vertical intersection data collection. Both of these have been developed to give the Ai data on the position of the robot arm. I'm also looking at using the functions to read a chess board and distinguish between different pieces on a square irrespective of there position or orientation in the square

This version has some new image scan functions which include movement detection and a way of finding the vertical coordinates of objects. ISF's can now be lumped into one scan thus speeding up processing time. It takes less than a second to download, scan, process and respond to images from the web cam. Some new keywords have been added and a couple of processes have had some optimization work in order to speed up processing times. I noticed an Ai with over 40,000 entries in the BD was running a bit slow. Most of the Ai's i use have around 5000 to 15,000. I've been working on making the documentation clearer. Work has started on the robot arm which is powered by air. Its being attached to Robot Hamish, some of the new image scan functions are being designed to track the position of the arm. What i really need is a way of finding out how far the air ram has extended.

I've uploaded a video to YouTube Robot Hamish auto-navigating. The video shows robot Hamish auto-navigating around a room. These days the robot is pretty good at avoiding objects. Training the robot to navigate the room has been quicker than expected, the robot quickly finds places to get stuck in which it can then be trained to avoid.

The latest version includes a new keyword ImageScanFunctions this is a collection of functions that analyze images. At present there are 23 functions these include functions that highlight colors, areas of shade and another vertical and horizontal line finder function. These have been created for robot navigation and to enable the robot to distinguish between objects. I use 5 of these functions for the robot to navigate in a room with various objects being detected by the functions, all image processing is done in memory and image drawing and scanning is done using the DX window this means using a number of different functions in sequence only takes a fraction of a second. The room the robot is in has a floor made of floor boards which are not even, there are lines in between the boards which get detected by the vertical line scan so the new functions are designed to get around this by using different techniques. Another problem has been getting the robot to distinguish between the wooden floor and wooden chair legs and piles of burner wood. Using a variety of different techniques gets around this problem. A code is created from the scan and this code is compared to the previous 1000 codes created. Over time matches are found and these can be added to the database. When a match is found then cell 1611 is activated, the new tag <lookup-ac> can be used to see if the code exists in the database and if so activate the associated cell. Some of the functions adjust the image to prepare it for other processes. Differences in light can effect the color functions, i keep the robots lights on to minimize this effect and also use a different data set for day and night. These functions are enabling the robot to auto navigate for many hours without getting stuck.

New version AiV016i. Image scanning routines have been worked on this is enabling the robot to roam around a room using vision to guide it. A new keyword ImageScanVerticalCalibrate gives the Ai the ability to reset its vertical line scan sensitivity automatically.
The Image and DX windows are now part of the user window which also has the ability to embed up to 9 browser windows. This makes controlling the robot easier
A grammar filter has been added to the output filter and the ability to control which outputs are processed, also a new process is being worked on called Sentence Type (ST).

An update from Microsoft for Windows can make fonts go weard it can effect a number of applications including the font used by the Ai. Microsoft may send out a fix in the future i've fixed this problem on my machines by removing the security update Kb3013455.
Some functions have been updated to work better with cell activations and some changes made to the way neural network training data is stored. The training data files are stored in the weights folder and the Ai can only look in this folder for the data, doing it like this means the Ai will still work properly if the data is moved to other machines running the program. The Brain dialog box has had some functions combined and a couple of buttons removed. Training data is saved automatically when the TRAIN or UPDATE buttons are pressed.
a small bug in the code that generates the emotion code has been fixed
The help file has been updated

I've just set up my latest venture called Yorkshire Robot Company which can be found at yrc.biz. YRC has been set up to commercialize the robots. At some point we intend to set up a workshop or factory to build them and we are in the process of looking for suitable premises in the Yorkshire area.
The latest version of the Ai is still 16f with some new keywords and a new program called AiK8055InterfaceV002.exe This program is used to take inputs from a k8055 card and transmit them to the Ai. This enables 4 cards to be used and gives allot of flexibility to how the data can be processed. The program transmits a standard 9 bit neural network code, information on what cell to transmit to and whether the cell should be activated. The code transmitted by the program is used to set up the input code of he named cell.

A new version with more control over the analog outputs. This is for better robot control the analog outputs now use a cells input code to set the values. Robot Two is now built more information about the robot project can be found here. Version 16f has some more keywords and some refinements to the DT routine.

To speed up image processing time a new Direct X (DX) window has been added to the program. Direct X is a way for programs to communicate with hardware like graphics cards and use their resources. The DX window is used mostly by the robot which uses the keywords ImageLoadScan and ImageScanVertical
to help with navigation. Using Direct X means image processing takes under a second using the DX window, if the DX window is closed then the Image window is used which takes 4 seconds. Using DX means the robot can now move at a reasonable speed.

A new routine called DID short for Dig In Deeper this is similar to the 6P routine but digs deeper into the database to find word connections. The help file has been updated and sorted out a bit more. I've made a few tweaks to the 6P routine in an attempt to get it to use the best answer of the ones it produces. The settings dialog box has been reorganized and a few more functions added to the audio player. I use the ai to play music these days as the quality seems better than other players. I think this is because it uses the MCI device in the computer and thus communicates with the sound card directly without doing any preprocessing to the sound. A couple of new keywords have been added to clean in cell fields. These are the cell numbers that a cell connects to and are used by a number of processes. 6P learning and LM learning set up these cells but sometimes strange associations appear whilst these can be fixed manually I've found some instances where a small word can have many associations. 6P learning has been tweaked to try and reduce this from happening. A number of processes produce answers that whilst they contain good words in there output the structure and some of the words spoil the quality of that output. I'm trying to work out a way of correcting these grammar mistakes. Its so easy when you look at the outputs to work it out but getting the computer to do it is proving very hard.

This version has a number of new routines and tweaks which are used for controlling the robot which is now built. These new functions use edge detection to extract data from an image captured by the robots web cam and use the information to build up a location map so the robot knows where it is and can navigate autonomously. These routines use an electronic compass which is controlled using a separate program also part of the download. This program sends the compass data to the Ai and sets input codes in the Ai's Brain Database. Whilst the code is written i haven't had much time or power to fully test the routines so how well this technique works remains to be seen. The robot uses a laptop computer and is powered by 2 car batteries, the motors are from an electric wheelchair, the reason for building the robot so powerful is so it can also be used for carrying heavy objects.

Some new tags and an upgrade of the autolearn keyword to make it more reliable and work on different machines. The way Create HTML works has been changed. Tags are now used in template web pages, the tag <cell: > activates the cell whilst the page is being built, the tag is replaced with the output from the cell.
Work has started on the Emotion routines and there is a new Subject process. Some of the robot has been built i'm now looking for two electric wheelchair motors so i can build the drive unit.

New server program called AiServerV008.exe in the server folder. This is simple text only tcp/ip server used to communicate with the Ai from a web page. This is being used for house automation systems that i'm working on. At the moment i'm using it to control relays which control various systems around my house using my Kindle as a remote control. The server provides a very simple and efficient way of communicating with the Ai over networks and removes the need to set up a full web server.
A new project i'm working on is to build a robot that will be controlled by the Ai. The design has been worked out, how long it will take to build depends on available funds!

This version has a few bug fixes and a few new functions which include the new keyword AutoLearn. This enables the Ai to harvest online data and add it to its Brain database. The QTF process which queries remote Brains has been upgraded to work with this enabling a remote Ai to be used for data acquisition then send it to another Ai when a QTF request has been received. The keyword ExtractWords is a simple parser for web pages. It extracts just the text from the page removing all coding tags. Not all web pages work due to the way there designed and present text. AutoLearn can be used to update a entry i use it for updating the news entry and the weather entry so when i type in news i get the days news. Words not in the database are searched for in a online dictionary and the data including the word type is downloaded and added automatically. When the QI process acts on this new data logical conclusions can be made by the Ai that it hasn't been taught. If you get the error: cant open file ALFile.txt you need to update entry 1602 this is the System Cell used to control AutoLearn if LM is ticked in settings, look in stuff to add to help.txt for details.
All text and background colors can now be changed using System cell 816

There are two versions of the program in the latest release AiV015b is the latest version using two databases. AiV016a is a total rebuild of the Ai. The biggest change is the merging of the NNE and TF databases into one database called the Brain database. When the program is first run it creates a new file in the data folder called BrainDatabase.dat if the program finds the TF database from previous versions then if offers the user the option to import the data into the new format, no change is made to the original file. The process of rebuilding the Ai is complex and has produced a few bugs, most of which have now been fixed but this is an ongoing process and more will appear. During this process all functions are being checked and in some cases changed, a new help file will be available soon.

New version AiV015a.A few improvements have been made these include; the ability to export the TF database to spreadsheet CSV file and import a CSV file into the Ai, some special codes that use numbers have been changed to make import and export work. Optimized data storage for faster processing. Upgrade to the image window and associated functions.

The new DLL K8062.dll is used to operate the Velleman K8062 USB to DMX controller. Signals can be sent from the neural network to DMX devices.

The new Deeper Thought (DT) routine that changes and forms new connections in the neural network from changes made to the Ai's output is working well, this technique is enabling the Ai to learn.

New routines that work by feeding information back into the neural network enabling it to establish new word connections and learn through conversation. This routine is still being developed so information about it is in rough note form which can be found in the file: stuff to add to help.txt in the help folder.


We would be very interested to know what you think about the program so please email us.
If you have a use for the Ai and need some form of extra functionality or a change in the program to adapt to you own needs then this may be possible but expect to pay something!
The program has zero funding and is a labor of love so if you want to invest in this project or any other Spud projects then please email us at:

Screen shots...

Ai main Window

Ai small window

Brain Database

Ai settings control how the Ai works

Can it think?
Whilst this is the goal the Ai program is very long way from this which is why there is no end envisaged in the development of the program. Over the past nine years that i have been writing the program i have had to try and analyze in microscopic detail how we humans understand words and speech, when someone says something to us what are the thought processes involved. Whilst this might not be the best way to start such a program it did seem the most logical approach as a program that can understand and react accordingly to human input is potentially the most useful. The Ai takes the sentence and checks it against words in the data base this produces information like what types of words are in the sentence nouns, verbs, questions etc. at the time of writing i have defined 80 different word types. The program also looks at the structure of the sentence checking this structure or parts of it against common know patterns this information is also stored in the data base. This information is then processed by algorithms. At this time there are 25 processing algorithms. Each algorithm asses the quality of its reply then the final translation algorithm chooses the answer that has the highest reply quality RQ and sends its reply to the output. Translation algorithms are:

  • Question Noun Verb (QNV) If a question word in the input is followed by a noun followed by a verb then it is assumed the verb is referring to the noun and a match is looked for in the noun and verbs description e.g.. the input "how do fish swim" will produce the output "fish swim fins". This routine gets better with more words in the data base and the better the descriptions.
  • Question Is (QI) if in the input there is a question followed by the word "is" then the Ai will send the description of the word after "is" to the output e.g.. "what is a fish" will produce the description of the word "fish" the word "a" is ignored. so the output would be "Vertebrate cold-blooded animal with gills and fins living wholly in water or in the sea"
  • Pattern and sentence code (SC) when the input is translated all the words are assigned a mnemonic dependant on there word type. The Sentence Code (SC) is checked for in the Brain Database(BD) also known patters are looked for in the SC. If a full SC is found in the BD then it has the same functions like any word. If a pattern is found in the SC then the extended pattern functions routine is also used. The pattern routine is used for things like looking in the log for words e.g.. "look in log for fish". The SC for that input is: _Šƒe] the pattern: _Šƒe has been set up to use the word after the pattern as the word to search for in the log, so the word "fish" is searched for. The answer sent to the output is "fish, found in the sentence, input: what is a fish" assuming logging is on in Settings (S). There is an ever expanding list of functions in the extra pattern routine look in help for more details.
  • Short Term Memory (STM) sometimes referred to as the Data Store holds the previous number of entries as set in settings. Words in the input are compared to words in previous inputs with the most frequently found words coursing a response. If an unknown word is repeated then this is detected. Repeated words are compared with subject words and if a match found then the conversation subject variable is set. If a repeat pattern is found then when the file loops then the SC's are added to the BD, if there are not already in the BD and Learning routine is ticked in settings.
  • Neural Network (NN) this code was written by a programmer called Boris and integrated into the Ai. The NN code works in a similar way as neurons in our own brains. The NN is mostly used by the NNE routine but some early code is still in the program which uses the NN in a different way.
  • Neural Network Extended (NNE) this routine is very powerful and has a lot of potential. Each cell can do many different functions depending on how the cell is set up. Cells are activated in sequence using a matrix file or by other means. The cell sets up the weights of the NN and then puts the cells input code into the NN which produces the output code which can be used to control input codes in other cells or follow instructions from associated entries in the main data base.
  • Reference Action Subject (RAS) the RAS routine breaks down the input into 3 distinct types. This routine is designed to look at individual words in more depth. The routine utilizes the search routine first looking for the subject word then rescanning for the reference and action words. The assigning of words to different types is dependant on the types of words in the input ie the subject word may be the noun in the sentence and the reference may be the verb in the sentence but if there is no verb and there are 2 nouns then the reference word will be one of the nouns. Look in the help file for more details on what words types are used and when. This routine is proving particularly useful in finding information that could be in many files. The test, search file, contains over 60 different files from text files to web pages that are searched. The search takes less than a second on 1296mhz laptop. Because the RAS routine breaks down the sentence to 3 words only you would have thought that the meaning in the sentence would be lost but most times this isn't the case consider the question 'please tell me what the capital of england is' RAS=england-tell-capital this quite clearly describes what is wanted, this also means that different ways of talking or asking for something can still produce the correct answer.
    If a file that is searched contains 2 or more of the RAS words then the sentence containing the words is sent to the output. The BD is also searched for the 3 words joined eg. england-tell-capital if found in the BD field 8 is sent to the output.
  • LM, DT, 6P, NNEB, NNEC, These routines use the NN in different ways and are described in more detail in the help files

Functions, uses and jobs
Here are some of the things i have been teaching the Ai to do.

The Ai can work with a server and receive input from form data, from a web page. This data can be processed by the Ai and the Ai output can be built into a web page. The Ai uses template web pages to construct pages or can insert code directly into a page. This function is most useful for communicating with the Ai over the internet.

Communication using UDP/IP or text files, this can be used for instant messaging or using two programs to pass data e.g. using 'scanimage' and 'compairimage' you can set the Ai to monitor images from a web cam and if the image changes then communicate the information over the internet. Some web cam's come with software that is more sophisticated at monitoring and takes pictures when movement is detected, if this is the case you can use the keyword 'scanfornewfile' which can then let you know when an new image has been taken. The Ai can also read and write to a text file on the computer its running on or to a networked computer. It can also read text files created by third party software.

The Ai can search through files for words in the sentence, the files searched can be different depending on the search type. The search routine can search any text file. The output of searches can be sent to the output, written to a file or embedded in a web page, when the results are embedded in a web page then the filenames are converted to links.

You can run as many different versions of the program on one computer but each instance of the program needs to be in its own folder and have its own database. This means you can use each instance to do a particular job. You could use one as a translation tool for translating from one language to another whilst another is monitoring a zone using a web cam with another as the main communication program receiving inputs from each and processing accordingly then sending the information over the internet to another Ai program on another machine. Linking Ai's has many possibilities.

Stats, statistics are gathered from every routine in the program and displayed as a graph when stats is checked in settings. The thought behind collecting stats was so the Ai could be used for document analysis. The values are converted to a 9 bit binary code which is used for the input code for entries 1000 to 1199 in the database. Look in the help file under 'stats' for more information of which BD cell number relates to which stat. Each inputted word is assigned a number depending on the word type, this number is added to 1200 and the input code of the BD entry is increased. eg. the input in BD entry 1202 is incremented every time a noun is found. The information on what word type has what number is also in the help file. This information can then be processed by the neural network depending on the way the cells are programmed and processed using a matrix file.

The Ai uses a third party program called Auto It. This program is a scripting program and is very good at controlling windows. You can script mouse movements and clicks, which means anything you can do with a mouse an Auto It script can do. Auto It scripts are activated by the keyword 'autoit'.

Functions are describe in more detail in the help file which is part of the download. As the program develops more functions are expected. Its worth pointing out that functionality has not been restricted or controlled so be careful when setting up system commands.

Home | Email Spud | Spud Ai

Spud Ai