Arduino - AI Number Guessing Game

by Suspense_Comix in Circuits > Arduino

689 Views, 1 Favorites, 0 Comments

Arduino - AI Number Guessing Game

AI Guessing Game.png

This is an AI Guessing Game I made using an Arduino. I got some help from this guy (https://forum.snap.berkeley.edu/u/dardoro/summary) for the code. Here's a demo if you need: AI Guessing Game V1 | Tinkercad

Supplies

1 Arduino UNO R3 board

5 Blue LEDs

5 Green LEDs

10 Resistors (1K ohm)

5 mini breadboard pushbuttons

1 Small Breadboard (Or any size as long as there are + and - power rails)

Wires (Any color will do as long as they are red, black, green, and blue.)

Explanation

You can skip this step. But anyways, if you took a look at the code, you might be confused as to what the terms mean. There's the "Memory Module", the "Thinking Module", and the "Reset Module". These are just terms I invented following with a research article I wrote about my thoughts and theories on AI and how it worked.


The Memory Module stores memory. It's the backbone of the entire AI.

The Thinking Module is many if statements combined together which makes the AI make a desired output. The output depends. There are 2 states of the Thinking Module. The BeforeState and AfterState.

The BeforeState is when the Memory Module is empty. It will make a random result and try to learn from it. The AfterState is when the Memory Module starts to fill up and so the Thinking Module uses the Memory Module.

The Reset Module is a module that resets the entire AI in case things go wrong and in case the Memory Module is too packed. In JAVA, we call this "Garbage Collection".


Does any of that make sense? No? Well, to be honest I made this step at midnight. So it is pretty sloppy.

Start Wiring (PART 1)

AI Guessing Game Wiring.png

This is when you actually start making the Hardware and wiring it. Anyways, take 5 blue wires and wire it as shown. Also attach LEDs and resistors as shown. This will be the AI's number indicator which will indicate the number it has guessed. You will have to read the numbers top to bottom, no binary, etc.


Also make sure you wire the Positive and Negative as shown using your black and red wires.


Feel free to shorten them.

Wiring (pART 2)

AI Guessing Game Wiring 2.png

Now, wire the buttons and such so that the Player can have turns in this game. Again, feel free to shorten the wires.

Code

Download all the code into the description. Then paste it into the Arduino IDE and upload the code to the Arduino.

Test and Play With It

Now is when you test and play with the game!


Round 1: Firstly, choose a random number, and then the AI will guess a random number to collect data from you.

Round 2: Next, choose another random number after the AI has guessed its number. You will see that the AI guessed the number you choose in the last round.

Rounds 3 through 5: The cycle will repeat. The AI will guess the previous round's number.

Round 6: Now is when the AI resets. There is no confirmation message or anything that tells you when the AI resets, but the cycle will cease once the AI guesses a random number and not the same number you got in the last round.