Below is a code sample of a spam filter I wrote for my MAT345 course, Intro to Data Science. This sample shows a full process of parsing and cleaning data, training a machine learning algorithm, and testing the algorithm’s performance against a known data set. Throughout my implementation of the Naïve Bayes algorithm, I kept focus on utilizing the C++ STL to simplify the complexity, run-time, and readability of my code.
Below is a code sample from the collision system I programmed for Mosh Pit. This sample shows the collision detection between two any-sided convex polygons. As per my implementation of the Separating Axis Theorem, I iterate through every normal vector of both polygons checking if there is a gap between the two polygons when I project all the points into one dimension. If there is no gap, I save the shortest penetration depth and other relative information for position correction and impulse-based collision resolution.