A CLI implementation of the 2048 game, written in Python.
If you have pipx installed:
pipx install [email protected]:clifflau1120/python-2048.gitor you can build from source with uv:
git clone [email protected]:clifflau1120/python-2048.git
cd python-2048
uv python install 3.13 # install Python 3.13
uv python pin 3.13 # pin Python 3.13
uv venv # create a virtual environment
source .venv/bin/activate # activate the virtual environment
uv sync --locked --all-extras --dev # sync dependencies to the virtual environmentTo start a new game:
python-2048 runTo continue from a previously saved snapshot:
python-2048 run <game_snapshot_path>To enable LLM-based suggestion, as supported by pydantic_ai:
python-2048 run --model <model_name>To observe how an LLM plays 2048:
python-2048 run --impersonate --model <model_name>This repository uses ruff for formatting and linting:
ruff format
ruff check... and pyright for type checking:
pyright... as well as pytest for testing:
pytestYou can install pre-commit hooks so that code quality is verified on each commit:
pre-commit installThis repository uses calendar versioning.