All Projects โ†’ plibither8 โ†’ 2048.cpp

plibither8 / 2048.cpp

Licence: mit
๐ŸŽฎ Fully featured terminal version of the game "2048" written in C++

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
Meson
512 projects

Projects that are alternatives of or similar to 2048.cpp

2048.node
๐ŸŽฎ Terminal version of the game 2048 written in Nodejs
Stars: โœญ 18 (-99.05%)
Mutual labels:  2048, 2048-game
2048-react
2048 game on React
Stars: โœญ 13 (-99.31%)
Mutual labels:  2048, 2048-game
cxk-2048-react
๐Ÿ“ A noisy 2048 game. ไธ€ไธช้ญ”ๆ€งๅˆๅต้—น็š„2048ๅฐๆธธๆˆใ€‚
Stars: โœญ 13 (-99.31%)
Mutual labels:  2048, 2048-game
2048-typescript-cocoscreator
๐Ÿš€ A 2048 Canvas Game.
Stars: โœญ 15 (-99.2%)
Mutual labels:  2048, 2048-game
2048-game
2048 Game implementation based on Preact+Redux
Stars: โœญ 17 (-99.1%)
Mutual labels:  2048, 2048-game
Swoole Game
ๅŸบไบŽSwooleๆ‰ฉๅฑ•ๅผ€ๅ‘ๆธธๆˆๆœๅŠกๅ™จๆก†ๆžถ๏ผŒ็คบไพ‹ๅฎž็Žฐh5ๆธธๆˆๅผ€ๅ‘
Stars: โœญ 131 (-93.05%)
Mutual labels:  game
Azuriom
Azuriom is a modern, reliable, fast and secure game CMS.
Stars: โœญ 135 (-92.84%)
Mutual labels:  game
Code Vr
๐Ÿ Program and explore real applications with virtual reality! Learn how to program, compete to build apps, and even collaborate with other people in realtime, in game or not!
Stars: โœญ 131 (-93.05%)
Mutual labels:  game
Reldens
Reldens - You can make it - Open Source MMORPG Platform
Stars: โœญ 130 (-93.11%)
Mutual labels:  game
Cross Lib
CROSS LIB - A universal 8-bit library and some games built with it
Stars: โœญ 137 (-92.74%)
Mutual labels:  game
Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: โœญ 138 (-92.68%)
Mutual labels:  game
Hortor Cheater
ๅคด่„‘็Ž‹่€…ไฝœๅผŠ่พ…ๅŠฉๅทฅๅ…ท
Stars: โœญ 135 (-92.84%)
Mutual labels:  game
Gocraft
A Minecraft like game written in go
Stars: โœญ 1,704 (-9.65%)
Mutual labels:  game
Bootmine
Bootable minesweeper game in a 512-byte boot sector
Stars: โœญ 136 (-92.79%)
Mutual labels:  game
Kudos
Kudos is a simple, high-performance, easy to expand and easy to deploy distributed game service framework based on microservice architecture, It is based on RPC of rpcx, supports pomelo communication protocol and can be easily applied to game development.
Stars: โœญ 132 (-93%)
Mutual labels:  game
Leelasabaki
Leela (Zero) integration with Sabaki.
Stars: โœญ 138 (-92.68%)
Mutual labels:  game
Phaser3 Particle Editor
A flexible editor for building phaser particles.
Stars: โœญ 131 (-93.05%)
Mutual labels:  game
Tacks
Real-time multiplayer sailing game, in your browser
Stars: โœญ 134 (-92.9%)
Mutual labels:  game
New Eden Social
๐ŸŒŒ New Eden Social ๐Ÿš€
Stars: โœญ 136 (-92.79%)
Mutual labels:  game
Canvas Test
๐ŸŽฎ happy canvas
Stars: โœญ 1,722 (-8.7%)
Mutual labels:  game

2048.cpp

Actions Status Codacy Badge Language grade: C/C++ Made with Love in India Run on Repl.it

Terminal version of the game "2048" written in C++.

๐ŸŽ‰ Featured on GitHub's Twitter and Facebook pages! ๐ŸŽ‰

2048 in action!

Setup

The game and code is made to run natively on the GNU/Linux and MacOS platforms, but cross-platform compatibility for Windows has been added too.

Requirements

  • C++11 compiler (e.g. g++, clang++, pgc++, icpc, etc.)
  • Virtually any platform including:
    • Linux
    • MacOS
    • Windows (via Cygwin or Windows Subsystem for Linux)
  • CMake or Meson

Installation

  1. Open your terminal in your preferred directory and clone this project:
git clone https://github.com/plibither8/2048.cpp
  1. Enter the project directory:
cd 2048.cpp

For both CMake and Meson, the default C++ compiler on your system will be used. If you wish to manually select a C++ compiler, optionally add CXX=clang++ cmake or CXX=clang++ meson etc.

Building with CMake

  1. Build the executable and run tests
ctest -S setup.cmake
  1. Install the program (optional)
cmake --install build
  1. Run the program and play the game! ๐ŸŽ‰
2048    # run `build/2048` if game is not installed

OR

Building with Meson

  1. Generate build configuration
meson build
  1. Build the executable and run tests
meson test -C build
  1. Install the program (optional)
meson configure build --prefix=$HOME/.local
meson install -C build
  1. Run the program and play the game! ๐ŸŽ‰
2048    # run `build/2048` if game is not installed

Contributing

First of all, thank you for contributing ๐Ÿ˜„! A few things to note:

  • If you have found a bug, or have a feature that you'd like implemented, raise an issue.

  • If you have proposed a pull request, make sure that you run clang-format on the source code (both, .cpp and .hpp) files if you've made changes there.

  • In your local repository, run git update-index --skip-worktree ./data/*.txt to ensure that changes to the data files are not tracked by git, and thus are not staged.

Thanks

I deeply appreciate the help of the following people:

  • Michael Hirsch
    • cleaned up the code,
    • organised the header files in a better way for a more efficient build,
    • added the AppVeyor CI,
    • added the Meson build system and, fixed CMake and added install feature.
  • Aiman Ismail added support for Vim keybinding.
  • Patrik Huber fixed a typo in the Readme.
  • zestze changed cstdlib rand to C++ random int generator.
  • Pascal J. Bourguignon added support for ANSI arrow keys.
  • Jean-Michaรซl Celerier added CMakeLists.txt file.
  • comwrg made the duration in the statistics and highscores human-readable, wrapping seconds to minutes and hours.
  • Christian Bundy replaced the ugly -, + and | with box-drawing characters.
  • Tor E Hagemann fixed issue #10, causing unwanted character 1 to be printed.
  • farazxameer implemented feature to save a game state and continue from a saved game state, refined game logic.
  • drodil implemented checks to ascertain existence of data files, fixed issue #12
  • Aviskar KC added arrow keys to game instructions.
  • Peter Squicciarini fixed readme instructions.
  • Mark Fischer, Jr. fixed a typo.
  • Hugo Brandรฃo completely reorganised the existing project structure and updated the build method to enfore CMake.
  • Alton Alvarez fixed a typo.
  • cawvyoct made the source code much, much easier to read: removed most magic numbers, replacing them with variables to ease maintenance. Implemented clang-format.
  • Cong edited the Game class constructor.
  • Tien Do added the 'exit' option in the main menu, updated the CMakeLists.txt file and made Color enum to a scoped enum.
  • ScorrMorr made many methods consts.
  • tangmengqiu fixed an error-causing instruction step in the readme.

Maintainers

Notes

[GameBoard].getTile(2,0) refers to the 0th tile (or column) in 2nd row as in this case, x = 0 and y = 2. The specific tile is denoted the by '@' symbol in the following gameboard:

Note: row and column indexing starts at 0.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      โ”‚      โ”‚      โ”‚      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚      โ”‚      โ”‚      โ”‚      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   @  โ”‚      โ”‚      โ”‚      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚      โ”‚      โ”‚      โ”‚      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜

To-Do

  • Add start menu [19/04/2018]
  • Save highscore / score [21/04/2018]
  • Save a game state and play from a saved game state
  • AI (Abandoned indefinitely)

License

Copyright (c) Mihir Chaturvedi. All rights reserved.

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].