{"id":18250412,"url":"https://github.com/qtle3/ms_rolling_dice","last_synced_at":"2025-04-08T20:27:30.678Z","repository":{"id":250804685,"uuid":"835525538","full_name":"qtle3/ms_rolling_dice","owner":"qtle3","description":"This Python program lets you create and use a multi-sided die, just like the ones you’d use in board games. With this class, you can make dice with any number of sides, roll them to get a random number, and set or check the current value showing on the die. The program also includes a simple example to show how it works.","archived":false,"fork":false,"pushed_at":"2024-07-30T03:06:14.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T16:01:54.005Z","etag":null,"topics":["class-definition","encapsulation","initialization","randomization"],"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/qtle3.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":"2024-07-30T02:46:45.000Z","updated_at":"2024-08-01T04:53:15.000Z","dependencies_parsed_at":"2024-07-30T07:12:11.004Z","dependency_job_id":null,"html_url":"https://github.com/qtle3/ms_rolling_dice","commit_stats":null,"previous_names":["qtle3/rolling_dice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtle3%2Fms_rolling_dice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtle3%2Fms_rolling_dice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtle3%2Fms_rolling_dice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtle3%2Fms_rolling_dice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qtle3","download_url":"https://codeload.github.com/qtle3/ms_rolling_dice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247921510,"owners_count":21018609,"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":["class-definition","encapsulation","initialization","randomization"],"created_at":"2024-11-05T09:44:37.572Z","updated_at":"2025-04-08T20:27:30.425Z","avatar_url":"https://github.com/qtle3.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MSDie: Multi-Sided Die Class\n\n## Overview\n\nEver wanted to create your own multi-sided die like the ones you use in board games? This Python program lets you do just that! With the `MSDie` class, you can make dice with any number of sides, roll them to get a random number, and set or check the current value showing on the die. There's also a simple example included to show you how it works.\n\n## How It Works\n\n### MSDie Class\n\n1. **Initialization (`__init__`):**\n   - When you create a die, you specify how many sides it has, and it starts with the value 1.\n\n2. **Rolling the Die (`roll`):**\n   - The `roll` method changes the die's value to a random number between 1 and the number of sides.\n\n3. **Getting the Current Value (`getValue`):**\n   - The `getValue` method lets you see the current number showing on the die.\n\n4. **Setting the Face Value (`setValue`):**\n   - The `setValue` method allows you to manually set the die to a specific number.\n\n### Example Usage\n\nThe `main` function in the code shows you how to create a 6-sided die, set its value, roll it, and then get the current value. The result is printed out so you can see it in action.\n\n## Key Concepts Covered\n\n- **Class Definition:** Learn how to create a class with methods and attributes.\n- **Initialization:** Understand how to set up an object's initial state with the `__init__` method.\n- **Randomization:** Use the `randrange` function to generate random values.\n- **Encapsulation:** Create methods to interact with the object's data (`roll`, `getValue`, and `setValue`).\n- **Example Usage:** See a simple program demonstrating how to use the class.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtle3%2Fms_rolling_dice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqtle3%2Fms_rolling_dice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtle3%2Fms_rolling_dice/lists"}