so_long is a simple 2D top-down game built with the MLX42 graphical library, as part of the 42 core curriculum. The game involves parsing and rendering a map, handling player movement, collecting items, and reaching an exit — all while ensuring proper memory management and error handling.

- Map parsing from
.berfiles with full validation - Real-time keyboard controls
- 2D rendering using textures via MLX42
- Win condition tracking and step counter
- Flood-fill algorithm for accessibility validation
- Graceful error handling and memory cleanup
- Dynamic texture loading and player tracking
- The player (
P) must collect all collectables (C) - Then reach the exit (
E) to win - Walls (
1) are impassable - Empty spaces (
0) are walkable - Game ends with a win or window close
A valid map file must:
- Be rectangular
- Be enclosed by walls
- Contain 1 player, 1 exit, and at least 1 collectable
- Only use characters:
01PCEExample: 111111 1P0C01 100001 1C0E11 111111
- Navigate to the project directory:
git clone https://github.com/Yuxin29/Solong.git Solong
cd Solong
- Compile using the provided Makefile:
make # Generate the executable so_long
- Other make commands:
make clean # Remove object files
make fclean # Remove object files and executable
make re # Recompile everything from scratch
- Running the Game Run the game with a valid .ber map:
./so_long path/to/map.ber