Skip to content

lukandooo/backgammon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Console Backgammon (C / ncurses) - First Project (2023)

A terminal-based implementation of the classic board game Backgammon, written in pure C. This project was created as my first major programming assignment (2023). It demonstrates fundamental concepts of low-level programming, including pointer arithmetic, memory management, and procedural logic implementation without the aid of Object-Oriented paradigms.

Features

  • Player vs Computer AI: Play against a basic algorithmic opponent that evaluates moves based on game state.
  • Rules Implementation: Full validation of Backgammon moves, including hitting logic, bar re-entry, and bearing off.
  • Save/Load System: Ability to serialize the game state to a file and resume gameplay later.
  • Visuals: Text-based user interface (TUI) utilizing the ncurses library for rendering the board in the terminal.

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine.

Prerequisites

To run this project, you need a C compiler and the Ncurses library.

  • Linux (Debian/Ubuntu):
    sudo apt-get install libncurses5-dev libncursesw5-dev
  • macOS:
    brew install ncurses
  • Windows: Recommended to run via WSL (Windows Subsystem for Linux) or using a compatability layer like PDcurses with MinGW.

Compilation & Execution

  1. Clone the repository:
    git clone [https://github.com/your-username/console-backgammon.git](https://github.com/your-username/console-backgammon.git)
    cd console-backgammon
  2. Compile the code:
    gcc main.c -o backgammon -lncurses
  3. Run the game:
    ./backgammon

Controls

Once the game is running, you can use the following keys to interact with the menu and gameplay:

Key Action Description
M Move Roll the dice and start your turn.
N New Game Reset the board and start a new match.
S Save Save current game state to save_file.txt.
L Load Load game state from save_file.txt.
Q Quit Exit the application.

Gameplay Input: When asked for a move, type the column number (e.g., 06 or 24) to select the pawn, and then the destination column.

Author

Lukasz Swiecicki

  • Year 2023
  • Project created as part of University coursework.
  • Focus: C Programming, Algorithms, Data Structures.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors