A simple version of the 2048 game for the command line. Made in pure C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
nicolas d46a9aabfb
reupload repository
3 years ago
.gitignore reupload repository 3 years ago
2048game.c reupload repository 3 years ago
LICENCE reupload repository 3 years ago
README.md reupload repository 3 years ago
list.c reupload repository 3 years ago
list.h reupload repository 3 years ago
run.sh reupload repository 3 years ago

README.md

2048-in-c

  • This is a 2048 game I made to teach a friend to program in C/C++.
  • It is based on an university assignment we found.
  • It's intended to be played on the terminal.
  • We were starting from 0, so the code is very simple and not elegant at all.

Originally, I programmed the whole thing without using external functions or pointers as the assignment indicates.

Controls:

  • Key (w, a, s, d) = (up, left, down, right)
  • Key q = quit the game.

Updates:

  • Rewrote some parts of the code to follow quality standards.
  • Translated it all to English to follow international standards.
  • Added functions to reuse code and make it more elegant.
  • Add a good algorithm to search a random unused matrix cell now using pointers. For this I created a List module. This increased the speed notoriously.
  • Also added a missing detail: when generating a new number, it generated a 2. Now it's corrected as the original game generates a 2 or a 4.