CS 18 (Spring 2026) Project 01: Pacman (Engine)

In this project, you will begin your physics engine by starting to build the underlying data structures.

Code Correctness

Setup

If you haven’t already, please do the Setup for the course. Otherwise, just register for the project using the registration tool and clone the repository as explained in the setup instructions. Please use the SSH link found on the registration page and in the email sent to you. It should look something like git@gitlab.caltech.edu:cs18-26sp/project01-blank.git.

Goals and Deliverables

In this project, you’ll begin writing the codebase that you’ll be working with over the next several weeks; it is very likely that you will still be using some of this code in week 10 of the term.

vector_t

In vector.h, we’ve provided function prototypes which you should implement in vector.c. See the provided documentation in vector.h for what the functionality should be. Your vector.c file should (1) include the vector.h header and (2) define the functions specified in vector.h. You’ll be writing an extensive set of functions that act directly on vector_ts that are not pointers. Your vector_t will eventually represent position, velocity, acceleration, and other vector quantities in your physics engine.

list_t

You will not have to implement list_t, but we’ll point out a few things here that should make it easier to interact with them.

body_t

body_t will be our primary structure to represent objects in our demos and games. For now, they’ll have a color, shape, rotation, velocity, position, and mass. The mass won’t be used in your demos this week, but they will be used once we implement forces and impulses in the next few weeks.

The shape of the body_t can be represented as a fixed-size list_t of vector_t’s. We will take the convention that a body’s vertices are stored in a counter-clockwise order. Like you did with vector_t, look at the provided documentation in body.h and implement body_t.

scene_t

We’ll also implement a new scene_t abstraction to represent a collection of bodies. While its functionality seems pretty basic for now, it will be much more helpful in later weeks and prove to be much easier to manage than a list_t of bodies.

Running and Testing your Code: make and the Makefile

All the projects in our class will have the following directory structure:

We have provided you with a Makefile which is set up to build the project. It allows you to run the following commands:

To run all the tests, all you need to type is make test. To run compile and run an individual test suite, run the following commands (replacing vector with the test suite you want to run):

make bin/test_suite_vector
./bin/test_suite_vector