Universal, Plug-in-Play Scoring System
Project description
pyscored – Universal Plug-in-Play Scoring System
pyscored is a powerful, flexible, and easy-to-use Python library designed for universal scoring management. It seamlessly integrates into various applications, from game development frameworks to modern web applications, providing robust scoring functionalities through a secure sandbox environment and a versatile plugin architecture.
Features
- Universal Integration: Compatible with game frameworks (e.g., Pygame, Pyglet) and web backends (e.g., FastAPI).
- Plugin-Based Architecture: Easily extend scoring logic with customizable plugins.
- Sandbox Environment: Ensures safe execution of dynamic scoring rules.
- Flexible API: Supports dynamic scoring configurations and rule management.
Installation
Install pyscored easily using Poetry:
poetry add pyscored
Quick Start
Here's a quick example to initialize and use the Scoring Engine:
from pyscored.core.scoring_engine import ScoringEngine
engine = ScoringEngine()
engine.initialize_score("player1", initial_score=0)
engine.update_score("player1", 10)
print(f"Current score: {engine.get_score('player1')}")
Features & Integrations
Dynamic Rules
Easily define and apply dynamic scoring rules:
engine.configure_rule("triple_points", lambda points: points * 3)
points_awarded = engine.apply_rule("triple_points", points=5)
print(f"Triple points awarded: {points_awarded}")
Plugin System
Extend functionality using provided or custom plugins:
- ComboBonusPlugin: Bonus points for consecutive successful actions.
- StreakRewardPlugin: Special rewards for successful action streaks.
Example of registering plugins:
from pyscored.plugins.combo_bonus_plugin import ComboBonusPlugin
combo_plugin = ComboBonusPlugin(name="combo_bonus", bonus_threshold=3, bonus_multiplier=1.5)
engine.register_plugin(combo_plugin)
Framework Adapters
Game Development
Integrate with popular game frameworks:
from pyscored.adapters.game_frameworks import GameFrameworkAdapter
adapter = GameFrameworkAdapter(engine)
adapter.setup_player("player1")
adapter.update_player_score("player1", 20)
Web Applications
Easily implement gamification in web applications:
from fastapi import FastAPI
from pyscored.adapters.web_frameworks import WebFrameworkAdapter
app = FastAPI()
web_adapter = WebFrameworkAdapter(engine)
@app.get("/score/{user_id}")
async def get_score(user_id: str):
score = await web_adapter.get_user_score(user_id)
return {"user_id": user_id, "score": score}
Documentation
Detailed guides, API references, and usage examples are available in the documentation.
Contributing
We welcome contributions! Please refer to our CONTRIBUTING.md for guidelines on how to contribute effectively.
License
pyscored is licensed under the GNU License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyscored-0.1.0.tar.gz.
File metadata
- Download URL: pyscored-0.1.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7386b39dc1df37001f16a8a4b7ab091f7355cd6a9e265238c6eb1fd61c1f2f46
|
|
| MD5 |
c02d2dee888b400a6554e8d5f30e60ac
|
|
| BLAKE2b-256 |
943eb3c7377cc803a1e98b9ab9c06b934aed35c795f917a9dba89602af047124
|
Provenance
The following attestation bundles were made for pyscored-0.1.0.tar.gz:
Publisher:
publish.yml on EricsonWillians/pyscored
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyscored-0.1.0.tar.gz -
Subject digest:
7386b39dc1df37001f16a8a4b7ab091f7355cd6a9e265238c6eb1fd61c1f2f46 - Sigstore transparency entry: 181099350
- Sigstore integration time:
-
Permalink:
EricsonWillians/pyscored@3ec4a2569976e285a2c7eb464d9ebc63f948a23b -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/EricsonWillians
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ec4a2569976e285a2c7eb464d9ebc63f948a23b -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyscored-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyscored-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f10f7491ee1f71efccd1b1f268d6ad821c42ea4ea84a61943fa804e38d824c6d
|
|
| MD5 |
55ea600d56ed4e541cfc5e5ccbf791a3
|
|
| BLAKE2b-256 |
83910c420567d9e2242406ec4ed77e4792a18d5ad758b9e75ed65a3dc6f39db2
|
Provenance
The following attestation bundles were made for pyscored-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on EricsonWillians/pyscored
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyscored-0.1.0-py3-none-any.whl -
Subject digest:
f10f7491ee1f71efccd1b1f268d6ad821c42ea4ea84a61943fa804e38d824c6d - Sigstore transparency entry: 181099354
- Sigstore integration time:
-
Permalink:
EricsonWillians/pyscored@3ec4a2569976e285a2c7eb464d9ebc63f948a23b -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/EricsonWillians
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ec4a2569976e285a2c7eb464d9ebc63f948a23b -
Trigger Event:
release
-
Statement type: