class
aicafe.SnakeSet
This class represents a set of snakes. To initialize a snake set,
see __init__() below.
__init__(self, snakes, types=None)
Initialize a snake set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snakes
|
Sequence[ArrayLike]
|
Each array is used to initialize one snake, so it must satisfy the
requirements for initializing a snake, see
|
required |
types
|
Sequence[int]
|
The types of snakes represented by integers. Only used when values in |
None
|
lengths(self, idxs=None)
Lengths of some snakes in self.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idxs
|
Sequence[int]
|
List of integer indexes of snakes. If |
None
|
Returns:
| Type | Description |
|---|---|
list[float]
|
The lengths of designated snakes. |
Examples:
n_snakes(self)
The number of snakes. Can also get it using len(self).
types(self)
Types of snakes, represented by integers, as defined in TYPES_SNAKES.