# module `td_2a.dice`#

## Short summary#

module `ensae_teaching_cs.td_2a.dice`

source on GitHub

## Classes#

class

truncated documentation

`DiceStraight`

Inspired by Problem A. Dice Straight. …

## Static Methods#

staticmethod

truncated documentation

`max_number_sequences`

Returns the maximum number of sequences given the number of dices.

`parse`

Reads the content of a problem Returns a list of `DiceStraight`.

## Methods#

method

truncated documentation

`__init__`

Dices = list of 6-uples

`__len__`

Retourne le nombre de dés.

`__str__`

Displays dices.

`longest_straight_sequence`

Returns one of the longest sequence of consecutive integers. It returns a list of tuple (face, dice). The implementation …

## Documentation#

source on GitHub

class ensae_teaching_cs.td_2a.dice.DiceStraight(dices)#

Bases : `object`

Inspired by Problem A. Dice Straight. On dispose de n dés à six faces, chaque face contient un nombre entier. On dispose les dès en ligne en choisissant chaque face de telle sorte que le nombre entier d’un dé précède celui de son voisin de droite, plus exactement, on veut construire une suite d’entiers consécutifs. Le problème consiste à déterminer, pour un jeu de dès donné la séquence la plus longue.

source on GitHub

Dices = list of 6-uples

source on GitHub

__init__(dices)#

Dices = list of 6-uples

source on GitHub

__len__()#

Retourne le nombre de dés.

source on GitHub

__str__()#

Displays dices.

source on GitHub

longest_straight_sequence()#

Returns one of the longest sequence of consecutive integers. It returns a list of tuple (face, dice). The implementation may be improved a lot.

source on GitHub

static max_number_sequences(n)#

Returns the maximum number of sequences given the number of dices.

source on GitHub

static parse(str_or_file)#

Reads the content of a problem Returns a list of `DiceStraight`.

Paramètres:

str_or_file – string or filename

Renvoie:

list of `DiceStraight`

source on GitHub