Skip to content

Abusalah0/2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terminal 2048

A fully playable 2048 game in the terminal, built with ncurses.

Features

  • Classic 2048 gameplay in a terminal UI
  • Start menu with 4x4 and 5x5 grid selection
  • Window resize support in menus and gameplay
  • Colored tiles (when terminal color support is available)
  • Lightweight C project with Makefile build

Requirements

Install ncurses development libraries:

sudo apt-get install libncurses5-dev libncursesw5-dev

Build And Run

# Clone repository
git clone https://github.com/Abusalah0/2048.git

# Enter project directory
cd 2048

# Build
make

# Run
./2048

Controls

  • Up arrow: move tiles up
  • Down arrow: move tiles down
  • Left arrow: move tiles left
  • Right arrow: move tiles right
  • Enter: confirm menu selection
  • q or Esc: quit game loop

Game Rules

  • Every valid move slides tiles in one direction
  • Equal adjacent tiles merge into one tile with double value
  • Score increases by the merged tile value
  • You win when you reach 2048
  • Game ends when no moves are possible
  • New tile spawn chance: 2 (70%), 4 (30%)

Resize Behavior

  • Menus and board redraw on terminal resize
  • Layout remains centered based on current terminal dimensions

Development

make        # build
make clean  # remove object files
make fclean # remove object files and executable
make re     # full rebuild

Troubleshooting

  • If colors do not appear, check whether your terminal supports colors.
  • If UI looks compressed, increase terminal window size.

Screenshots

Start Menu

Start Menu

Grid Selection

Grid Selection

First Tiles

First Tiles

Game Over

Game Over

About

the famous 2048 game, using C and the ncurses API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors