Giter VIP home page Giter VIP logo

2048's Introduction

2048

 .----------------.  .----------------.  .----------------.  .----------------. 
| .--------------. || .--------------. || .--------------. || .--------------. |
| |    _____     | || |     ____     | || |   _    _     | || |     ____     | |
| |   / ___ `.   | || |   .'    '.   | || |  | |  | |    | || |   .' __ '.   | |
| |  |_/___) |   | || |  |  .--.  |  | || |  | |__| |_   | || |   | (__) |   | |
| |   .'____.'   | || |  | |    | |  | || |  |____   _|  | || |   .`____'.   | |
| |  / /____     | || |  |  `--'  |  | || |      _| |_   | || |  | (____) |  | |
| |  |_______|   | || |   '.____.'   | || |     |_____|  | || |  `.______.'  | |
| |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------' 

Introduction

This project is a simple implementation of the popular game 2048 in C language. The game is a single-player sliding block puzzle where you combine tiles by sliding them in one of four directions (up, down, left, right). Each move adds a new tile randomly on the board, making the game progressively more challenging.

Requirements

To compile and run this implementation of 2048, you will need:

  • GCC (GNU Compiler Collection)

Building the Game

To compile the game, use the provided Makefile with the following command:

make build

This command will compile the source files and generate an executable suitable for running the game.

Running the Game

To start playing the game, run the following command:

make run

This will launch the game in your terminal.

How to Play

Objective

The goal of 2048 is to slide numbered tiles on a grid to combine them and create a tile with the number 2048.

Controls

  • Use the arrow keys to move the tiles:
    • Up Arrow: Moves the tiles upward.
    • Down Arrow: Moves the tiles downward.
    • Left Arrow: Moves the tiles to the left.
    • Right Arrow: Moves the tiles to the right.

Rules

  • On every turn, a new tile (with a number 2 or 4) randomly appears in an empty spot on the board.
  • Tiles slide as far as possible in the chosen direction until they are stopped by either another tile or the edge of the grid.
  • If two tiles of the same number collide while moving, they will merge into one tile with the total value of the two tiles that collided.
  • The game ends when the board fills up and no more moves are possible.

Winning the Game

To win 2048, create a tile with the number 2048. However, you can continue to play beyond this point to achieve higher scores.

Tips

  • Plan your moves ahead. Try to anticipate where new tiles might appear and how you can keep your largest tiles positioned to maximize your chances of combining them.
  • Keep your highest number tile in a corner and work the rest of the tiles around it. This strategy helps to avoid unnecessary tile mixing and maintains control over the game flow.

Enjoy playing 2048, and aim for the highest score!

License

Specify your license here if applicable, or state that it is unlicensed.

2048's People

Contributors

ohnnysong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.