{"id":24574157,"url":"https://github.com/miskibin/2048","last_synced_at":"2026-05-19T15:44:27.369Z","repository":{"id":175078551,"uuid":"652011680","full_name":"miskibin/2048","owner":"miskibin","description":"Implementation of 2048 game. This is web application with python backend and (js)jquery and bootstrap frontend.","archived":false,"fork":false,"pushed_at":"2023-07-04T11:42:21.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T20:57:01.742Z","etag":null,"topics":["2048-ai","2048-game","alpha-beta-pruning","fastapi","jquery-ajax","python","web-application"],"latest_commit_sha":null,"homepage":"","language":"Python","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/miskibin.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}},"created_at":"2023-06-10T19:52:20.000Z","updated_at":"2023-07-04T11:45:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"26724e2e-9f47-4902-88aa-6e5c19a9b265","html_url":"https://github.com/miskibin/2048","commit_stats":null,"previous_names":["michalskibinski109/2048","miskibin/2048"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miskibin%2F2048","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miskibin%2F2048/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miskibin%2F2048/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miskibin%2F2048/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miskibin","download_url":"https://codeload.github.com/miskibin/2048/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244023570,"owners_count":20385298,"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","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-ai","2048-game","alpha-beta-pruning","fastapi","jquery-ajax","python","web-application"],"created_at":"2025-01-23T20:57:10.114Z","updated_at":"2026-05-19T15:44:27.331Z","avatar_url":"https://github.com/miskibin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 2048 Game\n\nThis project implements the popular game 2048. The game is built using a combination of Python for the backend and HTML, CSS, and JavaScript for the frontend.\n\n## Contributors\n#### I am **absolutelly** open to contributions: \npotentaial tasks:\n- refactor frontend so it will be scallable to portable devices\n- Add new engine to game. It could be DQNagent, or some classic engine.\n## Features\n\n- The game is played on a grid with dimensions defined by the `shape` argument.\n- The game starts with two tiles, each with a value of either 2 or 4.\n- The player can move the tiles in four directions: up, down, left, and right.\n- When two tiles with the same value collide while moving, they merge into a new tile with the sum of their values.\n- After each move, a new tile with a value of either 2 or 4 appears on the board.\n- The goal of the game is to reach a tile with a value of 2048.\n\n## Installation\n\n1. Clone the repository:\n\n```shell\ngit clone https://github.com/michalskibinski109/2048.git\n```\n\n2. Install the required dependencies:\n\n```shell\npip install -r requirements.txt\n```\n\n3. Run the application:\n\n```shell\npython main.py\n```\n\n   The application will be accessible at `http://localhost:8000`.\n\n## Files\n\n- `board.py`: Contains the implementation of the game board and its operations.\n- `game.py`: Implements the game logic and provides methods to play the game.\n- `engine.py`: Implements the engine to find the best move using the minimax algorithm.\n- `main.py`: Sets up the API endpoints and runs the FastAPI server.\n- `templates/index.html`: HTML template for the frontend of the game.\n- `static/main.js`: JavaScript code for handling user interactions and making API requests.\n- `static/style.css`: CSS styling for the frontend.\n\n## API Endpoints\n\n- `GET /`: Renders the game interface.\n- `GET /board`: Returns the current state of the game board and score as JSON.\n- `GET /ai_move`: Performs an AI move and returns the updated game board and score as JSON.\n- `POST /move/{direction}`: Moves the tiles in the specified direction and returns the updated game board and score as JSON.\n- `POST /reset`: Resets the game board to its initial state and returns the updated game board and score as JSON.\n\n## Frontend Screenshots\n\n![frontend](https://github.com/michalskibinski109/2048/assets/77834536/445e0166-2bdb-4237-914e-5d5320566535)\n\n![documentation modal](https://github.com/michalskibinski109/2048/assets/77834536/70ccd4b8-6825-4fca-85dc-6bdba6f9b7af)\n\nFor more details and examples, please refer to the code and comments in the individual files.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiskibin%2F2048","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiskibin%2F2048","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiskibin%2F2048/lists"}