Creating an Asteroids Game in Pygame
I recently created a simple implementation of the classic arcade game “Asteroids” using Pygame, based on the “Build an Asteroids Game” project from boot.dev. This project was a fun way to explore game development and object-oriented paradigms in Python. In this post, I’ll walk you through the main components of the game. The Game Loop The core of the game is the main loop, which handles events, updates the game state, and draws everything on the screen. ...
Fixing My Broken Multiplayer Pong Project
The Problem: A Lesson in Client-Server Architecture During my computer networking class, I had an assignment to create a multiplayer Pong game using networking, threading, and a client-server architecture. At first glance, my implementation seemed to work. Both players could connect, see each others paddles move, and play the game. However, in my naivete, I let each client handle their own movement, leading to large desyncs, ultimately making the game unplayable. ...
How to Automatically Update a Fabric Minecraft Server with Node.js
How to Automatically Update a Fabric Minecraft Server with Node.js I run a small modded Minecraft server for me and my friends on a VPS. Every time Minecraft updated, all of my dozen or so mods would have to be manually downloaded, the server had to be stopped, the mods put in the mods folder, and the server would have to be restarted. This worked, but it was repetitive and fragile. So, as any good software engineer does, I decided to spend a lot more time developing an automatic solution to a problem than I would have spent doing it manually. Along the way, I learned a thing or two about APIs, scraping, and designing small automation systems. ...
Building a Neural Network from Scratch: the Math and the Code
Introduction When I took Machine Learning in College, I never felt that online resources described the mathematical foundations to my tastes. To try and fix this, in this post I’ll explore the mathematical foundations underlying neural networks and walk through my from-scratch implementation for binary classification on the moons dataset. We’ll dive deep into the calculus, linear algebra, and optimization theory that makes these models work, culminating in a network that achieves 99.6% accuracy on the moons dataset. ...
Building and Optimizing LSTM Networks for Sentiment Analysis
Introduction Recently, I’ve been tinkering around with training different AI models. Specifically, different types of networks. Long Short-Term Memory (LSTM) are good at natural language processing tasks, particularly sentiment analysis. In this demonstration, I’m going to build an LSTM-based sentiment classifier using TensorFlow and the IMDB movie reviews dataset. Then, I will compare different optimizers and learning rates to understand their impact on model performance. The Problem: Movie Review Sentiment Analysis The IMDB dataset contains 50,000 movie reviews labeled as positive or negative, making it perfect for binary sentiment classification. Our goal is to build an LSTM network that can accurately predict whether a review expresses positive or negative sentiment. ...
Building Logistic Regression from Scratch: A Complete Python Implementation
Introduction Understanding machine learning algorithms at their core is crucial for any data scientist. In this comprehensive tutorial, we’ll build logistic regression entirely from scratch using Python and NumPy. No black-box libraries, just the math implemented in code. We’ll use everything from the sigmoid function and cross-entropy loss to gradient descent optimization. Finally, we’ll test our implementation on the classic “moons” dataset to validate our approach. The Mathematical Foundation Logistic regression transforms linear combinations of features into probabilities using the sigmoid function: ...
Building a Reproducible Multi-Machine Setup with NixOS Flakes
Building a Reproducible Multi-Machine Setup with NixOS Flakes After years of manually configuring Linux systems and dealing with the inevitable drift that comes with imperative system management, I made the switch to NixOS. What started as curiosity about functional package management has evolved into a completely declarative approach to system configuration that I can’t imagine living without. In this post, I’ll walk through how I structure my NixOS configuration using flakes to manage multiple machines, integrate home-manager for user environments, and handle secrets with agenix. You can find the complete configuration on GitHub. ...
Finding the Longest Common Subsequence of DNA Strands
The Problem: Finding Common Ground in DNA In bioinformatics, comparing DNA sequences is a fundamental task. One common problem is to find the longest common subsequence (LCS) between two sequences. This can help us understand the similarity between two DNA strands, which can have implications for everything from genetic disease to evolutionary biology. This blog post walks through a C++ implementation I wrote to solve the LCS problem for two DNA sequences. The implementation follows the classic dynamic programming approach, which is a powerful technique for solving problems that can be broken down into smaller, overlapping subproblems. ...