Skip to main content

Board Game Builder

Project description

BoardGameBuilder

Object-oriented framework for build board game logic in python

pip install bgameb

Short example

from bgameb import Game

# create the game
game = Game('one_board_game')

# add dice and coin types to game
game.new('six', ctype='dice', sides=6)
game.new('twenty', ctype='dice', sides=20)
game.new('coin', ctype='dice') # 2 is default number of sides

# or define sides for dice and coin types
game.coin.sides = 3

# add shaker and add count of stuff to shaker
game.new('red_shaker', ctype='shaker')
game.copy('six', 'red_shaker', count=50)
game.copy('twenty', 'red_shaker', count=10)
game.copy('coin', 'red_shaker', count=42)

# roll all stuff and get result
result = game.red_shaker.roll()

# or define new shaker and add stuff directly
game.new('blue_shaker', ctype='shaker')
game.new('eight', ctype='dice', target='blue_shaker', sides=8, count=10)
result = game.blue_shaker.eight.roll()

# you can use dict notation offcourse
result = game['blue_shaker']['coin'].roll()

# delete components from any collections
del game.blue_shaker
del game.six

# define a cards and decks
game.new('one_card', ctype='card')
game.new('cards_deck', ctype='deck')
game.copy('one_card', 'cards_deck', count=100)

# deal card from deck
game.cards_deck.deal()

# dealt cards is a python deque
deck = game.cards_deck.dealt

# all rule is store in Game class
game.new('phase_one', ctype='rule', text='Important text')
game.new('phase_two', ctype='rule', text='Another important text')

# rule is a dict-like object
game.phase_one.additional = 'Add something else'

# lets create game turn structure
game.copy('phase_one', 'turn_order')
game.copy('phase_two', 'turn_order')
game.turn_order.deal()
current_turn = game.turn_order.dealt

Documentation

Development

how install project for development.

Available cli

make proj-doc

make test

make test-pypi to test deploy to testpypi

make log - insert fragmet name to store new about project

make ipython run interactive terminal

make check check flake8 and mypy

Available fragmet naming:

  • .feature: Signifying a new feature.
  • .bugfix: Signifying a bug fix.
  • .doc: Signifying a documentation improvement.
  • .removal: Signifying a deprecation or removal of public API.
  • .misc: A ticket has been closed, but it is not of interest to users.
  • .cicd: Integration tasks

make release - to bump version and build changelog. You can use towncrier build --draft to check changelog output

* for version management are used incremental and towncrier for changelog

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

bgameb-0.0.20.tar.gz (14.3 kB view hashes)

Uploaded Source

Built Distribution

bgameb-0.0.20-py3-none-any.whl (14.2 kB view hashes)

Uploaded Python 3

Supported by

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