c2048


Namec2048 JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python implementation of the game 2048 written in rust
upload_time2024-09-11 18:07:08
maintainerNone
docs_urlNone
authorCarlettos
requires_python>=3.8
licenseMIT
keywords 2048
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # C2048
C2048 is a Python library that implements the 2048 game written in Rust.

The game loop should look like this
```python
from c2048 import C2048, Move
game = C2048()

while True:
    print(f"Score: {game.score()}")
    print(game)
    # pick a random move
    move = Move.random()
    game.move(move)
    
    if game.has_moved:
        # Probability of getting a 2
        game.spawn_tile(0.9)
        # resets the game.has_moved
        game.reset()
    
    if game.is_win():
        print("You win, max tile: ", game.highest())
        break
    elif game.is_lose():
        print("You lose, max tile: ", game.highest())
        break
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "c2048",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "2048",
    "author": "Carlettos",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/dc/96/e68619b0cc8824669a3de551754328fe83c744fe637b726841359da3aca9/c2048-0.1.0.tar.gz",
    "platform": null,
    "description": "# C2048\r\nC2048 is a Python library that implements the 2048 game written in Rust.\r\n\r\nThe game loop should look like this\r\n```python\r\nfrom c2048 import C2048, Move\r\ngame = C2048()\r\n\r\nwhile True:\r\n    print(f\"Score: {game.score()}\")\r\n    print(game)\r\n    # pick a random move\r\n    move = Move.random()\r\n    game.move(move)\r\n    \r\n    if game.has_moved:\r\n        # Probability of getting a 2\r\n        game.spawn_tile(0.9)\r\n        # resets the game.has_moved\r\n        game.reset()\r\n    \r\n    if game.is_win():\r\n        print(\"You win, max tile: \", game.highest())\r\n        break\r\n    elif game.is_lose():\r\n        print(\"You lose, max tile: \", game.highest())\r\n        break\r\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python implementation of the game 2048 written in rust",
    "version": "0.1.0",
    "project_urls": {
        "Source Code": "https://github.com/Carlettos1/c2048"
    },
    "split_keywords": [
        "2048"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "27b1ffc84e61d0d1bceae1177c92b91e26485a6e906bd7cbb6deacd9b5e57c0a",
                "md5": "e45aa3e4771c3b70fc9a55955201ca26",
                "sha256": "0e9a98cfdbc53e5073b765739d6e5e8f0aa62fabb2d0ec4c4794ab3166d1670c"
            },
            "downloads": -1,
            "filename": "c2048-0.1.0-cp312-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "e45aa3e4771c3b70fc9a55955201ca26",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 162184,
            "upload_time": "2024-09-11T18:07:06",
            "upload_time_iso_8601": "2024-09-11T18:07:06.897041Z",
            "url": "https://files.pythonhosted.org/packages/27/b1/ffc84e61d0d1bceae1177c92b91e26485a6e906bd7cbb6deacd9b5e57c0a/c2048-0.1.0-cp312-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dc96e68619b0cc8824669a3de551754328fe83c744fe637b726841359da3aca9",
                "md5": "acb2d1df797c99cec382487ef8db3dac",
                "sha256": "0a822c129f3ad16543e90a9cacecc8f473f54faab7d0643f39c1fe5e3364100b"
            },
            "downloads": -1,
            "filename": "c2048-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "acb2d1df797c99cec382487ef8db3dac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8628,
            "upload_time": "2024-09-11T18:07:08",
            "upload_time_iso_8601": "2024-09-11T18:07:08.735070Z",
            "url": "https://files.pythonhosted.org/packages/dc/96/e68619b0cc8824669a3de551754328fe83c744fe637b726841359da3aca9/c2048-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-11 18:07:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Carlettos1",
    "github_project": "c2048",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "c2048"
}
        
Elapsed time: 0.44758s