ft is a monorepo of all my projects related to 42. It's mainly meant for personal archiving, but I also share some cool stuff.
This is a monorepository, meaning these projects are tightly coupled and share dependencies to work properly.
Why Zig instead of Make? The 42 curriculum relies heavily on GNU Make to teach students the fundamentals of compilation. However, maintaining 30+ nearly identical Makefiles in a monorepo quickly becomes tedious. Because I enjoy DevOps and reproducibility, I migrated this repository to the Zig build system. I now only generate a standard Makefile and clean the repo right before pushing a project for grading. I used to use Bazel to build my projects, but it's somewhat incompatible with Nix, so I moved to the Zig build system.
Caution
A natural side effect of this Zig setup is that it makes it harder to blindly copy-paste my projects and submit them as your own. While deterring cheating wasn't my primary technical goal, I fully support the result. Copying defeats the core principles of 42 and goes against what I personally believe in. This repository is meant to serve as an example of what you can build at this school, not as a shortcut. It's called a school for a reason. Learn; Write your own tests; and "By Odin! By Thor! Use your brain!".
Projects statuses
| Milestone | Project | Finished | Grade |
|---|---|---|---|
| 0 | ![]() |
✅ (with bonuses) |
125 |
| 1 | ![]() |
✅ (with bonuses) |
125 |
![]() |
✅ | 100 | |
![]() |
✅ | 100 | |
| 2 | ![]() |
✅ (with bonuses) |
125 |
![]() |
✅ | 100 | |
![]() |
✅ (with bonuses) |
125 | |
| 3 |
![]() with @maximart |
✅ | 101 |
![]() |
✅ | 100 | |
| 4 |
![]() with @maximart |
✅ (with bonuses) |
125 |
![]() CPP 00-04 |
✅ | (various grades) | |
![]() |
✅ | 100 | |
| 5 |
![]() with @maximart & @nahamida |
✅ | 125 |
![]() |
✅ | 90 | |
![]() CPP 05-09 |
✅ | (various grades) | |
| 6 |
![]() with @vblanc, @enpassel & @scottene |
✅ | 125 |
fdf![]() |
cub3d (and its 3DS port)![]() |
|---|---|
ft_linux![]() |
ft_transcendence![]() |
During a boring weekend, I set up a Bazel1 target to cross-compile a 3DS home-brew app. If you have a modded 3DS on hand, you can compile it and try yourself. It's very limited, laggy, and crashes on quit though. You have been warned. The level packaged is also very basic.
A program to flex on your friends by visualizing your push_swap algorithm in
Minecraft. It uses Valence to control the game packets
and visualize the sorting algorithm on your 1.20.1 client.
A simple script to convert a BMP2 image into a fdf file. It currently only works for bitmap images smaller than 255 * 255, because I don't really know how to reliably get the width of the image in the header.
Note
Did you read the foreword?
You can build all3 the projects in this monorepo using Zig.
- See the list of project in the main build file.
- Run
zig buildto make all projects at once (as well as the required external libs).
As per Zig fashion, building the entirety of the repo at once is pretty fast.
This project's dev dependencies are packaged using Nix in
a devShell that I personally use with
nix-direnv. There is a central
flake.nix that loads all nix files using import-tree.
I might eventually package the projects of this repo into this flake when I find the time.
If you use an IDE or LSP server and the constant clangd type errors appearing
when browsing this repo hurt your eyes, I might have a solution for you. The
compile_commands.json file! It instructs your LSP server on where to locate
the headers, and in which order, and how your build system (Zig in this case)
manages your compilation.
To compile this file for the whole project using Zig and Bear4:
bear -- zig buildNote
The compile_commands.json is gitignore'd for your inconvenience :-)
This project is licensed under the MIT License. See the LICENSE file for details.
Footnotes
-
I used to use Bazel to build my projects, but it's somewhat incompatible with Nix, so I moved to the Zig build system. ↩
-
You can convert PNG images to BMP using
convertfrom ImageMagick, or online with EzGIF. ↩ -
I haven't bothered to make everything compile using the Zig build system. At the time of writing and understandably, transcendence and the 3ds cub3d port must be compiled individually with their own tooling. I don't update the README as often as I update projects though, so take a look around and see for yourself! ↩
-
From https://github.com/rizsotto/Bear: "Bear generates a compilation database for Clang tooling." ↩



















