# game/¶

## logger.*¶

class ts2.game.logger.Message(parameters)[source]

Bases: PyQt5.QtCore.QObject

A Message instance holds all the data regarding one message emitted to the Message Logger of the simulation.

__init__(parameters)[source]

Constructor for the Message class. :param parameters: dictionary to build the message. Should have a ‘msgType’ and a ‘msgText’ keys. :type parameters: dict

__str__()[source]

Returns the string representation of the message.

for_json()[source]

Dumps this message to JSON.

class ts2.game.logger.MessageLogger(parameters)[source]

Bases: PyQt5.QtCore.QAbstractTableModel

A MessageLogger holds all messages that has been emitted to it and format them so that it can be used directly as a model for views.

__init__(parameters)[source]

Constructor for the MessageLogger class.

addMessage(msgText, msgType=2)[source]

Adds a message to the logger.

columnCount(parent=None, *args, **kwargs)[source]

Returns the number of columns of the model

data(index, role=0)[source]

Returns the data at the given index

flags(index)[source]

Returns the flags of the model

for_json()[source]

Dumps the messages to JSON.

headerData(column, orientation, role=0)[source]

Returns the column headers to display

initialize(simulation)[source]

Initializes the message logger once everything is loaded.

rowCount(parent=None, *args, **kwargs)[source]

Returns the number of rows of the model, corresponding to the number of messages in the logger.

## scorer.*¶

class ts2.game.scorer.Scorer(simulation)[source]

Bases: PyQt5.QtCore.QObject

A scorer calculates the score of the player during the simulation.

__init__(simulation)[source]

Constructor class for the Scorer class.

latePenalty

Returns the number of penalty points for each minute each train is late at each station.

score

Returns the current score.

trainArrivedAtStation(trainId)[source]

Updates the score when a train arrives at a station.

trainExitedArea(trainId)[source]

Updates the score when the train exits the area.

wrongDestinationPenalty

Returns the number of penalty points for leading a train in a wrong destination.

wrongPlatformPenalty

Returns the number of penalty points for leading a train onto a wrong platform.