CS Projects

Here you will find a collection of programming projects I have created. Take a look at the demos! Welcome any feedback.

Connect4

A Connect 4 terminal game written in C++, featuring PVP and PVE against a competitive AI named Zephyr. Zephyr uses convolution to detect patterns and tree search (alpha-beta pruning) to make decisions. Each round there is an emoji to indicate its "feelings" towards the chance of winning. Using multi-threading, it can search upto 11 layers down the tree within a satisfactory amount of time. I used ANSI escape codes to color the UI and make it more player-friendly.

To run the game, simply enter terminal commands as demonstrated in the video. For player arguments, the game automatically recognizes numbers between 1 and 11 as AI levels and string-like inputs as human players' names. Human players type a number to indicate the column for the next checker, and can undo their last move by pressing 0.

Graph Coloring

A Java program that finds all possible graphs on n vertices with coloring up to k colors, up to isomorphism. Each graph found can be pretty-printed using latex. Nicer recursive algorithms were developed alongside with rigorous math proofs to solve the problem on complete graphs and paths, as a part of my graph theory course midterm paper.

Shell

A shell written in C that supports running programs, job management, io redirection, signal handling, and a number of built-in commands such as cd, rm, jobs, fg and bg. For io redirection, the shell looks for redirection symbols and closes and opens necessary file descriptors before calling fork() to initiate a child process. Signal handling is done by using signal(), and reaping, happening each time before prompting for a new command, is done by iterating through a job list, calling waitpid(), and printing useful messages according to the exit status. Extensive error checking for user input and system calls.

Mandelbrot Set

A C++ program generating pictures of Mandelbrot set using multi-threading. It first initializes a 2D array, then each entry is associated with a complex number in the complex plane. Color is obtained by iterating the function f(z) = z^2 + c where z starts from 0 and applying arctan to normalize the color. Pixels in extreme bright areas are colored pure black, for the aesthetics of visualization.