Giter VIP home page Giter VIP logo

2048-game-using-react's Introduction

Getting Started with 2048 game

npm i

To install all the dependencies

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

how to play

Use your arrow keys to move the tiles. When two tiles with the same number touch, they merge into one!

Game information

See the section about deployment for more information.

Grid Representation: The game is typically implemented using a two-dimensional array or matrix to represent the grid. Each element of the array corresponds to a tile on the grid, with its value representing the number on the tile.

Initial Setup: At the start of the game, two random tiles (either 2 or 4) are placed on the grid. These tiles are usually positioned in random empty cells.

User Input: The game allows the player to make moves in four directions: up, down, left, or right. This can be done using arrow keys, swipe gestures (in mobile versions), or similar controls. The player's input triggers the corresponding movement of the tiles on the grid.

Tile Movement: When the player makes a move, the tiles on the grid slide as far as possible in the selected direction. If two tiles with the same number collide during this movement, they merge into a single tile with the sum of their values. After each move, a new tile (usually 2) is randomly generated and placed on an empty cell.

Game Over: The game continues until one of the following conditions is met:

The player reaches the 2048 tile, resulting in a win. There are no possible moves left, meaning the grid is full and no adjacent tiles can be combined. This results in a game over. Scoring: The player's score increases each time two tiles are merged. The score can be displayed on the screen to keep track of the player's progress.

Deployment

The game has been deployed to vercel - (https://2048-oguh.vercel.app/)

2048-game-using-react's People

Contributors

nikunj-bisht avatar

Watchers

 avatar

Forkers

nikunj-bisht12

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.