Welcome to the Snake Game: Terminal Edition (sgt
), a fun and interactive game built entirely for the terminal! Navigate menus, start the game, and enjoy an engaging experience using your keyboard. This project demonstrates real-time input handling in C with terminal-based interactivity.
- Interactive Menus: Use arrow keys to navigate through options.
- Real-Time Key Handling: Responsive keyboard input using raw terminal mode.
- Dynamic Display: Terminal menu updates in real-time ba user input.
- Expandable Gameplay: Built to serve as the foundation for a terminal-based Snake Game.
Here is a preview of the Game Menu:
Here is a preview of the Snake Game in action:
Ensure you have the following installed:
- A C compiler (e.g.,
gcc
) - A terminal emulator (Linux/macOS recommended)
- Docker (if using Docker image installation)
You have two options to install and run Snake Game: Terminal Edition (sgt
):
Follow these steps to clone, build, and install the game manually on your system:
Start by downloading the project repository to your local machine:
git clone https://github.com/medishen/sgt.git
cd sgt
Next, build the program using make
. This step compiles the source code into an executable binary.
-
Run the
make
command to compile the program:make
This will:
- Compile all
.c
files in thesrc
directory into.o
object files under theobj
directory. - Link the object files to create the final executable named
sgt
.
- Compile all
To make the sgt
game available system-wide (so you can run it from anywhere in your terminal), you can install it into your system's PATH
:
-
Run the following command with
sudo
to install the program to/usr/local/bin
:sudo make install
This step:
- Copies the
sgt
executable to/usr/local/bin
, a standard directory in your system'sPATH
. - Makes the game globally accessible from any terminal session.
- Copies the
-
You’ll see a confirmation message in the terminal, such as:
sgt has been installed to /usr/local/bin
After building (and optionally installing), you can start the game:
-
If you installed the game system-wide, simply run:
sgt
-
If you didn’t install it, run it from the project directory:
./sgt
If you prefer not to manually compile the program, you can quickly set it up using Docker.
-
Ensure Docker is Installed
Make sure you have Docker installed on your system. If not, follow the installation instructions for your platform.
-
Pull the Docker Image
To use the pre-built Docker image, run the following command to pull the image from Docker Hub:
docker pull bitsgenix/sgt
-
Run the Docker Container
After pulling the image, you can start the container with:
docker run --rm -it bitsgenix/sgt
This command will start the game automatically inside the container.
-
Interactive Mode
If you want to interact with the game in the terminal and keep it running interactively, you can use:
docker run --rm -it bitsgenix/sgt /bin/bash
Then, inside the container, run the game:
sgt
Contributions are welcome! If you have ideas for enhancements or fixes:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes and push:
git commit -m "Description of changes" git push origin feature-name
- Open a Pull Request.
For more detailed information on how to contribute, please refer to the CONTRIBUTING.md.
For details on version updates, refer to the CHANGELOG.md.
For any questions or common issues, check out the FAQ.md.
For detailed instructions on how to play the game, check out the USER_GUIDE.md.
For a detailed technical specification of the game, please refer to the SRS.md.
This project is licensed under the MIT License.
-
Docker Installation Details:
- The Docker image is pre-configured to run the game automatically. This is the easiest installation method, especially if you don't want to manually set up dependencies.
- To use the Docker container, simply run
docker run --rm -it bitsgenix/sgt
, and the game will start directly.
-
Build Details in Docker: The Dockerfile sets up the necessary environment, installs dependencies, compiles the source code, and makes the executable available in
/usr/local/bin/sgt
.If you'd prefer to customize your own build or test the source code locally, you can refer to Option 1: Installation via Cloning the Repository for a more manual approach.
Thank you for playing and contributing to Snake Game: Terminal Edition!