oneEngine package
Submodules
oneEngine.card module
- class oneEngine.card.Card(color: oneEngine.enums.Colors, card_type: oneEngine.enums.CardTypes)[source]
Bases:
object
- filter_playable_cards(deck: list[Card], rules: Rules, previous_color_selection: Colors | None = None) list[Card] [source]
- Parameters:
deck – list of cards that should be filtered
rules – rules applying to the game.
previous_color_selection – must be given if self is black and therefore a color has been selected.
- Returns:
list of cards that can be stacked on self.
- other_is_playable(other: Card, rules: Rules, previous_color_selection: Colors | None = None) bool [source]
determines whether a given card can be played on top self. :param other: other card that shall be stacked on self. :param rules: rules applying to the game. :param previous_color_selection: must be given if self is black and therefore a color has been selected. :return: True if other can be stacked on self.
- oneEngine.card.get_standard_card_deck() list[Card] [source]
- Returns:
standard uno deck see: https://de.m.wikipedia.org/wiki/Datei:UNO_cards_deck.svg
oneEngine.enums module
- class oneEngine.enums.CardTypes(*values)[source]
Bases:
Enum
- ADD2 = 12
- ADD4 = 14
- BLOCK = 10
- COLOR_SELECT = 13
- NUMBER_0 = 0
- NUMBER_1 = 1
- NUMBER_2 = 2
- NUMBER_3 = 3
- NUMBER_4 = 4
- NUMBER_5 = 5
- NUMBER_6 = 6
- NUMBER_7 = 7
- NUMBER_8 = 8
- NUMBER_9 = 9
- ROTATE = 11
oneEngine.game module
- class oneEngine.game.Game(player_count: int, rules: Rules, deck: list[Card] | None = None)[source]
Bases:
object
- property open_card
last card of self.open_deck (i.e. most upper card)
- Type:
return
- step(played_card_index: int | None, color_selection: Colors | None = None, swap_player_selection: int | None = None, add_4_challenged: bool = False) bool [source]
- Parameters:
played_card_index – index of card played by current player. None if no card shall be played and instead a card should be drawn
color_selection – a color except black must be given when played_card_index points to a card of type.
swap_player_selection
add_4_challenged
- Returns:
True if card is playable or not playing is possible
oneEngine.rules module
- class oneEngine.rules.Rules(player_card_count: int = 7, black_on_black: bool = True, zero_passes_on: bool = True, seven_swaps: bool = True, add_2_stackable: bool = True, add_4_challengeable: bool = True, draw_until_play: bool = True, mandatory_playing: bool = True)[source]
Bases:
object
- add_2_stackable: bool = True
- add_4_challengeable: bool = True
- black_on_black: bool = True
- draw_until_play: bool = True
- mandatory_playing: bool = True
- player_card_count: int = 7
- seven_swaps: bool = True
- zero_passes_on: bool = True