While working as an intern at a VR startup, I was tasked with creating an AI to simulate fish swimming underwater. Given that it was for a VR experience, performance was extremely important
I began by following a tutorial on Flock AI from Shinao on Github (https://github.com/Shinao/Unity-GPU-Boids), utilizing a simpler version of his approach, which was more optimized for VR and allowed the fish to swim in smaller schools, with more detail and “wiggling” to give the appearance of swimming. In the end, this is what we ended up with. In this clip (the only i’m allowed to post at this time) you can see a handful of schools procedural swimming around and minding their own business. The full version of the code also allows them to follow predefined paths with slight variations to still look natural. All in all, very fun and educational project
Random Coding Projects
Chess AI
As the final project in my Artificial Intelligence class, we created a game of chess in Unity where the computer made informed and strategic moves.
The AI is relatively simple. First It generates a list if possible moves, pushing them into a fitness sorted priority queue. Of those moves, it evaluates the ‘fitness’ of the resulting board. This is an incredibly simple calculation, as it just tallys each of the AI’s piece’s multiplied it by its associated value in inspector.
The players pieces then do some calculation, and the result is subtracted. This final value gives us our fitness for the move.
After each move is generated, it chooses the current best move (highest fitness), simulates it, and then attempts to predict what the players response will be. After generating a list of all of those moves, it assumes that the player will make the best move that it can, and so simulates said move. The new board (now two simulations in) is then fed back into the priority queue.
The algorithm then grabs the top of the priority queue, and the simulations begin again (resuming where they were if future moves have already been simulated for the current best performing move).
Now, it could keep doing this forever (or until it runs out of moves to simulate), but that wouldn’t be very fun for the player or the machine its running on.
Soooooo, there are two limiting factors: Depth, and Think Time
The depth refers to the number of simulated moves the game will generate spanning from a single starter move (included in the total). Given that it simulates its own moves and the players, a depth setting of 5 allows the AI to “plan” its next 3 moves.
Think time is what usually kills the AI’s turn, as it ensures that no matter what depth the AI is allowed to simulate to, it cant be thinking for more seconds than the Think Time Limit.
If you would like to see the code or download a playable build, head on over to my github: https://github.com/QuantumInfinite/ChessGame
Feed-forward neural networks for data classification
For one of my Artificial Intelligence projects, we had to study neural networks and how adjusting their initial properties effect their outcome.
To test this, we used two separate data sets, the age of Abalone’s (https://archive.ics.uci.edu/ml/datasets/abalone) and the the classification of Iris flowers (https://archive.ics.uci.edu/ml/datasets/iris)
Unfortunately, for this project we did not have time to use our own Neural Network. Instead we used WEKA, developed by the University of Waikato.
My findings and full paper can be found in the below linked pdf, and all of my datasheets can be downloaded at my github here: https://github.com/QuantumInfinite/Feed-forward-neural-networks-for-data-classification
Lotto 649 simulator
After getting tired of seeing friends drop money on lottery tickets every week, I decided to build this simulator over the course of a few hours (would have been faster, but i’m still getting used to the syntax of JavaScript)
The payouts are calculated based on the most resent lotto 649 winning stats (at the time of writing):