This is a JavaScript program that simulates an AI agent going to the store, buying items, and heading home. Perceptrons are used to help the agent make decisions in the program.
Perceptrons are one of the fundamental components of neural networks. Neural networks are part of machine learning, which is a subfield of artificial intelligence.
This program uses a few perceptrons to allow the AI agent to make deicisions in the program based on certain factors. The agent has to deal with uncertainity, probability, and learning from previous decisions to make future decisions to progress. Some user input is required to successfully complete the program.
While this is not as complex as other AI programs out there, writing this program has helped me understand artificial intelligence and machine learning better. I have placed comments throughout StoreTrip.js to help show what is happening in the program.
- Install latest version of Node.js through your terminal, if needed.
- Install either
npm i readline
ornpm i linebyline
through your terminal, if needed. - Navigate to the directory that you installed StoreTrip.js.
- Type
node StoreTrip.js
. - While running
StoreTrip.js
, you will get to the part where you are given three choices in the store. You can choosel
for left,r
for right, ors
to go straight down. The order does not matter. The AI agent will not leave the store until it goes to all three sections of the store at least once.