Skip to main content

No project description provided

Project description

Regicide

A framework for playing the card game Regicide.

Requirements

The package requires python version 3.7+ and should be compatible with Linux, Windows and macOS.

Installation

The Regicide framework can be installed in python using pip.

$ pip install regicide

Usage

Example

The following is an example of implementing an agent with custom behavior. In this example the agent will always choose to play the six of diamonds if available. Otherwise, it will choose randomly from the available actions.

import random

import regicide
from regicide import actions, card, players


class CustomPlayer:
    """
    A player that always plays the Six of Diamonds if possible.
    Otherwise it will choose a random action.
    """

    def play(self, state):
        legal_actions = state.action_space()

        c = card.Card(card.CardSuit.Diamonds, card.CardValue.Six)
        special_action = actions.ActionPlay(c)

        if special_action in legal_actions:
            return special_action
        else:
            return random.choice(legal_actions)


players = [CustomPlayer(), CustomPlayer(), CustomPlayer()]
game = regicide.RegicideGame(players, seed=1337)
result = game.playout()

print(result, game.reward())

API

The framework has three submodules: \cd{actions}, \cd{card} and \cd{players}. Each module contains python classes that can be instantiated and used in the framework.

Actions

Available actions are:

  • Play(card: Card)
  • AnimalCombo(cards: List[Card])
  • Combo(cards: List[Card])
  • Yield()
  • Discard(cards: List[Card])
  • ChangePlayer(id: int)
  • RefillHand

Cards

Available cards are:

  • Card(suit: CardSuit, value: CardValue)
  • CardSuit that can be: Spades, Hearts, Diamonds, Clubs or None.
  • CardValue that can be Ace...King or the special value Jester.

Players

  • InputPlayer() that allows user input for taking actions.
  • RandomPlayer(seed: int)
  • MCTSPlayer(playouts: int, num_threads: int, uct_variation: int, use_heuristics: bool)

Caveats

Currently, the python package does not support code suggestions in IDE's, making it more difficult to work with the package. This is a result of the method used to generate the python bindings and has no implication on actual performance or correctness of the program.

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

regicide-0.1.5.tar.gz (22.6 kB view details)

Uploaded Source

Built Distributions

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

regicide-0.1.5-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded PyPymanylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp310-none-win_amd64.whl (277.4 kB view details)

Uploaded CPython 3.10Windows x86-64

regicide-0.1.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (962.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

regicide-0.1.5-cp39-none-win_amd64.whl (277.7 kB view details)

Uploaded CPython 3.9Windows x86-64

regicide-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (964.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

regicide-0.1.5-cp38-none-win_amd64.whl (277.7 kB view details)

Uploaded CPython 3.8Windows x86-64

regicide-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (963.2 kB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

regicide-0.1.5-cp37-none-win_amd64.whl (277.5 kB view details)

Uploaded CPython 3.7Windows x86-64

regicide-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

regicide-0.1.5-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (963.4 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

File details

Details for the file regicide-0.1.5.tar.gz.

File metadata

  • Download URL: regicide-0.1.5.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.19

File hashes

Hashes for regicide-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f25a3fa2229b15539b1c374e6fd7eb2588c581a0c72695f749d3338f09581fd9
MD5 2bda275f87e1a6e2fc64455a01a4dc23
BLAKE2b-256 6f7c7fe53d4da3e6fd9e77f028eef889530af331b7b2d0ef6a45eab5c4e193d0

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8d74b886f96f9abb79ba576c18aff06eb5b0009178774016c03e67ed4f411746
MD5 2dc73a846611e793bb0ae452502a8b73
BLAKE2b-256 2973c79a96a8c11401efb10c0b9cf12b57b1c887ea96e78fb91b976910aa92ea

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1d96989f4bf6492a1421228f8482d0db25839a42f266c8552ebc2c5edc5250d3
MD5 a383c0f72ba12d68256a7f8e2c497ec7
BLAKE2b-256 d19b61057285d7b7de39e4c11a89cb08a178dfbd642174fa9b7fcef8c6fac181

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp310-none-win_amd64.whl.

File metadata

  • Download URL: regicide-0.1.5-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 277.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.19

File hashes

Hashes for regicide-0.1.5-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 734cd75f0b5fb252af083d27f125d0d0cf8ba6c4b77eeb4cf278355d4e93a64b
MD5 7be8152615e6e3687f6dff47c827dbb6
BLAKE2b-256 50b4803682bb2ef2fbab92b9b94c19ed1308c49695f6597b62993f8199600735

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9e7243b1123b78b333981615a01bc8b3d55f7600b093ee4524cb9546281103a8
MD5 d0bfe25a44cfd1dd6daacc9ffc97a174
BLAKE2b-256 b604eaea35792ddb551f88de72aaa649656e147bfb1f587ae594ee4a5ea75f55

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 84c972fb6926bf4bf784911d752a85b9502815dc9436ee6eea59015340b8d4c9
MD5 956d14367da9f4589e8e24c71cadd094
BLAKE2b-256 51452533311d8287d9573873485c8f5fdd14da790c76bd2e18a68dc0ec43ea9d

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp39-none-win_amd64.whl.

File metadata

  • Download URL: regicide-0.1.5-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 277.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.19

File hashes

Hashes for regicide-0.1.5-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 09db5d700ca8f1102a9dcc482a4d7ab4bc487833e6f2f09b5535af1d17450ea5
MD5 9c369646ffe9c27f983be52cf4b6c8f8
BLAKE2b-256 1df9fa06625ef3b774409d63b08d91e0e96689d83546a97c9897f8af00554159

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 df34b0c43256c9802d33da553d1cb71b9e5f7c9d39912f033f5e3129270fa0fd
MD5 f4110671d76b69ded765bef7dd8a21bf
BLAKE2b-256 c61c5412bcac1cbc68d1ed5e93e0cecb651ce9c9e920cc16004ebd1c87c04575

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 25c767d89dfed679f6b6f347b9a9fcfdda37f66ff38995de60ae117c89f5c983
MD5 991d99d82b4a9a12fe4f7182a9ff9689
BLAKE2b-256 6f08e4df63fab698bf24073dd47184ea29b384d677cd4aa5743dd630379eecc9

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp38-none-win_amd64.whl.

File metadata

  • Download URL: regicide-0.1.5-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 277.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.19

File hashes

Hashes for regicide-0.1.5-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 dac8d97779e4291308007cae348ac088f0fd8d260f9eb2488a8fae82337edc6f
MD5 ea8c5c1c84cd7f32de5202fcd7149fc9
BLAKE2b-256 e41455fae44994fb1ab9ac712c80f14f96b7a007b9c09d5f1048e4b23c4af44f

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 736cb88c44e4a9d491793a1b0f30c26f0da7580b64e2d39d35e4f76619b6dc37
MD5 0fa999dfe91fee7f4e49433fef313a96
BLAKE2b-256 33fcdd13520534a0ffa681b8b58da49a8ccec283d72ffc86e21f26035cdb1db5

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 54d2256f7f21ca95a37604f405e1a0e72b9466f3f92f57979f2850dbcc567c8e
MD5 a81886f64db6ea1ee224d64a6481db0a
BLAKE2b-256 3e6e1a41ed352c2f2b8ce6f183fc9d92b93ac3097917a1149b4cec2223f5d68a

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp37-none-win_amd64.whl.

File metadata

  • Download URL: regicide-0.1.5-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 277.5 kB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.19

File hashes

Hashes for regicide-0.1.5-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 3bd641551ff9b47fea0ee64c08fd5d3c58b285375b36c360dd86094b40628873
MD5 932a93d2d5d819c0c73a77d7bcd86cbd
BLAKE2b-256 bb06a951f363a92a5a1ace1180d5e471d4976fbea4e51cc3b012e1742fbbd2f3

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c2468f8b1afb5bddd5e93910812bc67d218c5df1fb01a8e7154c6596f314dfa9
MD5 f3360e138d3092714c596321fa4aa2ba
BLAKE2b-256 ddb08cae667a94430eb85f259f22059e8bfa989a80c5d479ba3381c0d18774d0

See more details on using hashes here.

File details

Details for the file regicide-0.1.5-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for regicide-0.1.5-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c0fd67a8f17aea93e7593c6d3372b0f1dcb174491857bdfe96acc11a49ccfc4b
MD5 f2596a35fb9c749918a4a99d836a4471
BLAKE2b-256 08475f46c390dcfd55f0f251c2f5cb207958bcba0e1040f5ec31e9209ae8d488

See more details on using hashes here.

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