Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscored-0.1.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyscored-0.1.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file pyscored-0.1.1.tar.gz.

File metadata

  • Download URL: pyscored-0.1.1.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

Hashes for pyscored-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f824e193b3133e61851af2a5b5da7c9aa22a089b2a71f7c16869c64728a6f2fa
MD5 d2c12c908f406b8ffed2641e9e587620
BLAKE2b-256 b9ad3c11575ed1130a58fa4cda40ada97443fb3826f7f9350ea9c0fd204a8232

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyscored-0.1.1.tar.gz:

Publisher: publish.yml on EricsonWillians/pyscored

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyscored-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyscored-0.1.1-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

Hashes for pyscored-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faeac5f06ad17ae14ed3ae9e20224c17f931c86cf96033a9cf2101f37bfc1d44
MD5 fc27774b6114d61d6b29190f90940f8b
BLAKE2b-256 7ad1e515a114eec58b54f953102f4893083a77c36fe5970cf7a5d136ec8ee0b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyscored-0.1.1-py3-none-any.whl:

Publisher: publish.yml on EricsonWillians/pyscored

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page