{"id":23539473,"url":"https://github.com/knoblauchpilze/2048","last_synced_at":"2026-05-16T08:02:59.204Z","repository":{"id":124351735,"uuid":"470599656","full_name":"Knoblauchpilze/2048","owner":"Knoblauchpilze","description":"A clone of the addictive game","archived":false,"fork":false,"pushed_at":"2024-01-10T16:55:20.000Z","size":216,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-29T04:00:00.613Z","etag":null,"topics":["2048","cpp","opengl","pixelgameengine"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Knoblauchpilze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-16T13:40:33.000Z","updated_at":"2025-01-16T20:18:35.000Z","dependencies_parsed_at":"2024-03-24T17:46:04.865Z","dependency_job_id":null,"html_url":"https://github.com/Knoblauchpilze/2048","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Knoblauchpilze/2048","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knoblauchpilze%2F2048","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knoblauchpilze%2F2048/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knoblauchpilze%2F2048/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knoblauchpilze%2F2048/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Knoblauchpilze","download_url":"https://codeload.github.com/Knoblauchpilze/2048/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knoblauchpilze%2F2048/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276668531,"owners_count":25683073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2048","cpp","opengl","pixelgameengine"],"created_at":"2024-12-26T04:36:17.492Z","updated_at":"2025-09-23T23:47:41.226Z","avatar_url":"https://github.com/Knoblauchpilze.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 2048\n\nA clone of the famous addictive game 2048.\n\n![2048 game](resources/game.png)\n\n# Installation\n\n- Clone the repo: `git clone git@github.com:Knoblauchpilze/2048.git`.\n- Clone dependencies:\n    * [core_utils](https://github.com/Knoblauchpilze/core_utils)\n    * [maths_utils](https://github.com/Knoblauchpilze/maths_utils)\n- Go to the project's directory `cd ~/path/to/the/repo`.\n- Compile: `make run`.\n\n# General principle\n\nThis application aims at reproducing the board game [2048](https://en.wikipedia.org/wiki/2048_(video_game)) using the Pixel Game Engine. This program proposes the basic behavior of the game along with a load/save mechanism and an undo option.\n\n# The application\n\nThe program presents several menus allowing to start a new game, load an exsiting one or play the game. Each screen can be reached when certain conditions are met.\n\nA game over screen appears when the user loses the game (which is bound to happen) and allows to either start a new game, leave the app, or go back to the main screen.\n\n## Main menu\n\nThe main menu allows to start a new game, load an existing one or quite the application.\n\n![Home screen](resources/home_screen.png)\n\n## Load/save game\n\nThe load and save menu allows to search for existing data files and load an existing game to continue it.\n\n![Load screen](resources/load_screen.png)\n\nThe user can pick the game they want and the application will then load it and move to the game screen.\n\n## Game screen\n\nThe game screen is where the user should spend the most time: it contains the main view on the game, but also some controls allowing to reset the game, display the current move and score, and also change the size of the main board.\n\n![Game screen](resources/game_screen.png)\n\nOnce in this screen, the only way out is to exit the application or lose the game.\n\n# The Game\n\n## Principle\n\nThe game is composed of a board with tiles having a certain value. The use ris able to merge tiles when two of them with the same value are close to one another, creating a new tile with twice the value of the two that were merged.\n\nThe user can control the board using the arrows key: a hit on the `left` key will make all tiles move to the left of the board, merging the tile that are on adjacent cells and reorganize the remaining ones starting from the left of the board.\n\nA similar process is applied when the user hits the `right`, the `down` or the `up` key.\n\nAdditionally, a random tile with a value of `2` or `4` will be spawned at a free location in the board.\n\nThe game stops when no more moves can be done (typically when the board is full).\n\n## Controls\n\nThe user can generate a new game with the `N` or `R` keys. This will reset the game to a new state.\n\nOne can control the moves on the board with the arrow keys. It is also possible to undo a last move (up to `5`) using the button on the status bar. We don't allow more than `5` undo operations and it is not possible to go back farther than the beginning of the game.\n\n![Status](resources/status.png)\n\nAt any time the user can check how many moves were made and how high of a score was accumulated. The way to accumulate point is to add each newly generated tile (so merging 2 `2`s will add `4` to the score).\n\n## Dimensions\n\nThe user can choose to play with a larger or a bigger board. The dimensions can be anything between `2x2` to `8x8`.\n\n![Dimensions](resources/dimensions.png)\n\nThe buttons are disabled in case the minimum/maximum size has already been reached for one dimension.\n\nNote that changing the size of the board will reset it.\n\n## Serialization\n\nThe serialization is done through files with a `\".2048\"` extension. These files are binary and provide the content to use to generate the board as it was at the moment of the save.\n\n### Header section\n\nThe first section defines the width and height of the board as a 4 bytes unsigned integer.\n\n### Game variables\n\nThe next section is composed of two 4 bytes unsigned integers, defining the number of moves performed at the moment of the save and the score reached for this game.\n\n### The board\n\nThe next section defines the board: we define it as 4 bytes unsigned values. The precise amount is computed as `width x height`.\n\n### Undo stack\n\nThe final section defines a first 4 bytes unsigned integers representing how many undo moves are available and then the content of the board for each state (using a similar syntax to what is used for the board).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknoblauchpilze%2F2048","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknoblauchpilze%2F2048","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknoblauchpilze%2F2048/lists"}