Coding Projects

Below are some of independent and class coding projects. Because some of the work was done for course assignments, the code is private. If you are interested in seeing the code, please email me at mp4215@princeton.edu.

AI with Python

Robot Arm Motion Planning

In this project, I modelled the continuous motion of an obstacle avoiding robot arm. By considering the configuration space of the system, I used a probabilistic roadmap to create a network of configurations that can be traversed using an A* search. I was then able to successfully model the path of the arm by using a color gradient ranging from red to blue to represent the arms position over time. On the left you can see the arm's path as it correctly folds in on itself to avoid obstacles.

AI with Python

Reeds-Shepp Car Motion Planning

I modelled the movement of a Reeds-Shepp car (a car which cannot rotate while remaining still) around obstacles on a plane. I used a rapidly exploring random tree, which is a configuration tree that rapidly expands in all directions from the start position until a position sufficiently nearby to the goal is reached, after which it back-chains to obtain the path for the robot to follow from the start to the goal. You can see some successfully simulated paths with and without padding (to allow a margin of error for the robot) on the left.

C++

Matrix Library and No-Library Neural Network

I created a functional matrix library from scratch in C++ over six weeks, with a focus on optimizing the efficiency of the library. The library includes memory optimization for sparse matrices, a Gaussian elimination solver, a least-squares optimization solver, LU decomposition, QR decomposition, and graph node smoothing via iterative application of the Laplacian matrix. I also created a neural network using my matrix library and was able to classify photographs of hand-drawn digits with 85% accuracy.

AI with Python

Sudoku and Kakuro Solver

Using propositional logic constraint satisfaction methods, this code can solve complex sudoku problems and beginner kakuro problems. It relies on WalkSAT to identify and flip successive variables that satisfy as many clauses as possible. I also added in redundant Ivor Spence constraints and constraints for the constants in order to significantly improve the efficiency of the solver. There were extra challenges in kakuro as De Morgan's law needed to be applied on large and complex string expressions in order for the constraint formats to be correct. Both puzzles were modeled by simple ascii displays.

AI with Python

Chess AI

I made a classic chess AI that used either Minimax or Alpha-Beta Pruning search algorithms. I was unable to beat my own AI (but I am not very good at chess) and I played several matches with the different algorithms against each other, while also implementing advanced move ordering, a transposition table, and Iterative Deepening Search to improve the efficiency and depth of the players. The ultimate winner was Alpha Beta with reordering which could function efficiently at depth 4. I used the python chess library for displaying the games real time.

Screen Shot 2020-08-09 at 11.32.59 PM

C with Unix development tools

Tiny Search Engine

Using homemade data structures, I created a Tiny Search Engine that crawls the web for documents, parses a user query boolean phrase of the form "cat and dog or mouseā€, then creates an inverted word-document index and returns the documents ranked by relevancy to the search phrase. The project was completed in four weeks with zero memory leakage.

Screen Shot 2020-08-10 at 12.31.34 PM

C with Unix development tools

Blind Robots on Server Maze Project

Along with three teammates, I created a maze simulation that is hosted on the Dartmouth servers. The program can take in parameters for number of avatars in the maze and for maze difficulty. The avatars must try to find each other in the maze by each communicating a move to the server one by one. The avatars are blind, so the program must map out the maze over time by checking if an avatar was able to make a move on its turn or not (in the latter case this indicates there was a wall there).

I specialized in creating the maze solving algorithms. Each avatar would block off dead ends as they found them to reduce the search space, use the right-hand rule to traverse the maze and leave breadcrumbs. At each turn, a breadth first search would be performed through the breadcrumbs, so that once the "breadcrumb islands" of all the avatars were connected we would know that there is a direct route between the avatars without undiscovered walls. A meeting point can then be determined and the avatars can backchain to the meeting point through their breadcrumb BFS trees. The combination of these methods was successful in quickly solving the mazes. Special thanks to my teammates Jonathon Alter, Charlie Nee and Pierre Benzy!

Screen Shot 2020-08-10 at 4.17.26 PM

Java

Hidden Markov Model Tagger

This tagging code takes in a sentence input from the user and uses a Hidden Markov Model to tag the role of each word in the sentence (eg "ADJ" would tag a word that is an adjective). The Hidden Markov Model is a graph which stores words as observations and tags as states. The model was trained on the Brown Corpus. Viterbi decoding is then used to find the most probable sequence of tags for the inputted line.

Java

Region Flooding Camera

In this class project, I made a basic region flooding class which floods a region of similar color in a photograph or live image. We were provided with a camera library and also scaffolding for the interface of the code. Using this code, one can create colorful live images, edit pre-existing images, and also draw in the air with something that is high-contrast relative to its environment.