Skip to content

Tile types

Tiles are the playing pieces in the Rummikub game. They are represented as subclasses of int, and for a given RuleSet, are given a unique numeric value. This means tiles for one ruleset can't be used with another.

All GameState methods that accept tiles, also accept regular int values, these are automatically be mapped to their Tile counterparts.

rummikub_solver.Tile

Bases: int

Base class for tiles.

The exact integer value of each tile is dependent on a given RuleSet.

rummikub_solver.Number

Bases: Tile

A number tile.

The exact integer value of each number tile is dependent on a given RuleSet, and tiles are best retrieved from the RuleSet.tiles sequence.

Attributes:

Name Type Description
value int

The numeric value

colour Colour

The tile colour

value instance-attribute

value: int

The numeric value

colour instance-attribute

colour: Colour

The tile colour

rummikub_solver.Joker

Bases: Tile

A joker tile.

Tile colours

The Colour enum lists the colours used for tiles in a RuleSet. E.g. the default ruleset configuration uses 4 colours, so the first four members of this enum are used to represent the colours. The actual colour value is abstract, red tiles work just the same as green tiles, etc. You can treat these as opaque tokens just to keep tiles from different colours apart.

rummikub_solver.Colour

Bases: Enum

Tile colours.

These are assigned to tiles in the order they are defined in this enum.

BLACK = auto() class-attribute instance-attribute

BLUE = auto() class-attribute instance-attribute

ORANGE = auto() class-attribute instance-attribute

RED = auto() class-attribute instance-attribute

GREEN = auto() class-attribute instance-attribute

MAGENTA = auto() class-attribute instance-attribute

WHITE = auto() class-attribute instance-attribute

CYAN = auto() class-attribute instance-attribute