# ๐Ÿช Cookie Clicker Bot A Selenium bot that plays [Cookie Clicker][game] for you: it clicks the big cookie, buys the most expensive upgrade it can afford every 5 seconds and prints the cookies per second after 5 minutes. It is the solution to day 48 of Udemy's *100 Days of Code: The Complete Python Pro Bootcamp*, written for course participants who want to compare solutions and for visitors who browse for ideas. ## ๐Ÿ“š Table of Contents - [Overview](#-overview) - [Requirements](#-requirements) - [Setup](#-setup) - [Run](#-run) - [Tests](#-tests) - [License](#-license) - [Links](#-links) - [Appendix: Project documents](#-appendix-project-documents) ## ๐Ÿงญ Overview The bot follows the five steps of the lecture: 1. Get to know the game. 2. Click the cookie as fast as possible, after dismissing the language selection. 3. Every 5 seconds buy the most expensive upgrade you can afford. 4. After 5 minutes stop and print `cookies/second`. 5. Tweak the strategy (check interval, buy one or buy all affordable). The repository is organised like this: | Folder or file | What it is for | | --- | --- | | `src/cookie_clicker_bot/` | The bot. `domain/` holds the rules (parsing, choosing the upgrade) with no Selenium, `application/` runs the game loop, `infrastructure/` drives the browser, `constants.py` holds every constant | | `tests/` | `pytest` tests; the unit tests need no browser | | `docs/` | Project documents, wiki pages (English, Danish, Bahasa Malaysia) and the screenshots of the lecture steps | | `Dockerfile` | A Linux image with headless Chromium for real-browser runs and screenshots | | `Doxyfile` | Doxygen configuration for the source comments | ## ๐Ÿ“‹ Requirements - Python 3.13 or newer. - Selenium (the only runtime dependency; it is installed by `pip` and finds the browser driver itself). - Google Chrome or Chromium to run the bot on your own machine. - `pytest` and `pytest-cov` for the tests (development extra only). - Docker, only if you want to run the bot or take screenshots without opening a window on your desktop. - Doxygen, only to build the source documentation. ## ๐Ÿ› ๏ธ Setup Create a local virtual environment, upgrade `pip` and install the project with the test tools: ```bash python -m venv .venv ``` Activate it: ```bash # Linux and macOS source .venv/bin/activate ``` ```powershell # Windows PowerShell .venv\Scripts\Activate.ps1 ``` ```bash python -m pip install --upgrade pip python -m pip install -e ".[dev]" ``` Leave the environment with `deactivate`. The folder `.venv` is ignored by git. ## โ–ถ๏ธ Run With the environment active: ```bash cookie-clicker-bot ``` or, without installing the command: ```bash python -m cookie_clicker_bot ``` To keep your desktop free, run it in the Docker container (headless Chromium): ```bash docker build -t cookie-clicker-bot . docker run --rm cookie-clicker-bot ``` ## ๐Ÿงช Tests ```bash python -m pytest ``` Coverage of the logic modules is checked with `python -m pytest --cov`. Tests that need a real browser are marked `browser` and run in the Docker container; all other tests need neither a browser nor the network. Build the source documentation with Doxygen: ```bash doxygen Doxyfile ``` ## ๐Ÿ“„ License GNU Affero General Public License v3.0, see [LICENSE][license]. ## ๐Ÿ”— Links - [Repository][repository] - [Documentation][documentation] - [Issue tracker][issues] ## ๐Ÿ“Ž Appendix: Project documents The documents a newcomer needs, in reading order. | Document | What it tells you | | --- | --- | | [AGENTS.md][agents] | The rules AI agents follow in this repository | | [Business Case][BC-001] | Why the project exists, its scope and success criteria | | [Stakeholder Analysis][SA-001] | Who is involved; the stakeholder IDs used for owners and reviewers | | [Project Plan][PP-001] | The gateways and their schedule | | [Milestones][milestones] | One document per gateway: Go/No-Go criteria and tasks | | [Artifact registry][registry] | Where each artifact type lives, the next version, the PO language and domain | | [Domain dictionary][DICT-001] | The PO terms and the IT terms | | [Traceability matrix][TM-001] | How the artifacts link and when each was last reviewed | | [Framework README][framework-readme] | The framework this project uses | | [Framework changelog][framework-changelog] | What changed in each framework release | --- [game]: https://ozh.github.io/cookieclicker/ [license]: ./LICENSE [repository]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new [documentation]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/wiki [issues]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/048-the-coockie-factory-new/issues [agents]: ./AGENTS.md [BC-001]: ./docs/business-case.md [SA-001]: ./docs/stakeholder-analysis.md [PP-001]: ./docs/project-plan.md [milestones]: ./docs/milestones/ [registry]: ./docs/artifact-registry.md [DICT-001]: ./docs/dictionary.md [TM-001]: ./docs/sqa/traceability-matrix.md [framework-readme]: ./framework/README.md [framework-changelog]: ./framework/CHANGELOG.md