Skip to content

JustShush/42_so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42 So_long

1. Requirements
2. Installation
3. Running
4. Game Rules

✔️ Requirements

  • Linux
  • MinilibX only support TrueColor visual type (8,15,16,24 or 32 bits depth)
  • gcc
  • make
  • X11 include files (package xorg)
  • XShm extension must be present (package libxext-dev)
  • Utility functions from BSD systems - development files (package libbsd-dev)
  • e.g. sudo apt-get install gcc make xorg libxext-dev libbsd-dev (Debian/Ubuntu)

🛠️ Installation

git clone https://github.com/42Paris/minilibx-linux.git
mv minilibx-linux mlx_linux
cd mlx_linux && make
cd .. && git clone https://github.com/JustShush/42_so_long.git
cd 42_so_long && make

all in one command

git clone https://github.com/42Paris/minilibx-linux.git ;mv minilibx-linux mlx_linux ;cd mlx_linux && make ;cd .. ; git clone https://github.com/JustShush/42_so_long.git ;cd 42_so_long && make

🎮 Running

Run the executable file followed by a valid map file, at the root of the so_long directory. Example:

$ ./so_long maps/map1.ber

Using your own map files

You can run the game with a custom map file as long as it follows the Game Rules.


📝 Game Rules

The executable so_long will receive a map as the only argument, and this map must have a .ber filetype.

The file also must follow these rules:

  • The only accepted characters are:

    • P (player)
    • 1 (wall)
    • 0 (empty)
    • C (collectible)
    • E (exit)
  • The map must be rectangular, i.e. all rows must have the same length

  • There must be only one exit and one player, and at least one collectible in the map

  • The map must be surrounded by walls

  • There must be a valid path the player can take from the starting position, to the exit, collecting all colletibles.


If any of these checks fail, the game will end with Error\n followed by a custom message.

The goal is for the player( to collect all the collectibles on the map before going to an exit in the least possible number of steps