fixed
Fixed messages sender implementation for the coding experiments library.
This module provides a sender implementation that cycles through a fixed set of pre-defined messages. It’s useful for reproducible experiments and testing scenarios where specific message sequences are required.
- class codinglab.senders.fixed.FixedMessagesSender(encoder, messages, logger=<codinglab.logger.NullLogger object>)[source]
Bases:
BaseSender[SourceChar,ChannelChar]Sender that cycles through a fixed set of source messages.
This sender repeatedly sends messages from a provided list, wrapping around to the beginning when the end is reached. Each message is assigned a unique ID for tracking purposes.
- Parameters:
encoder (Encoder[SourceChar, ChannelChar])
messages (List[Sequence[SourceChar]])
logger (TransmissionLogger)
- _messages
List of source messages to send
- _message_id
Counter for assigning unique message IDs
- _index
Current position in the messages list
- __init__(encoder, messages, logger=<codinglab.logger.NullLogger object>)[source]
Initialize the fixed messages sender.
- Parameters:
- Raises:
ValueError – If messages list is empty
- Return type:
None