Classes concerned with controlling what goes on during a lesson.
Generates messages to be delivered by whoever is conducting assembly. There is only one assembly message generator, shared by the whole skool.
Add template to the generator’s collection of message templates.
Add a word to the generator’s collection.
Parameters: |
|
---|
Return a message based on a randomly chosen template and containing randomly chosen phrases.
Controls the interaction between the teacher, the swot and Eric during a lesson. The various actions required by the teacher and the swot during a lesson - such as grassing on Eric for being absent, writing on the board, and asking and answering questions - are defined by individual methods on this class.
A new lesson is created by the swot when he sits down after being told to by the teacher at the classroom doorway.
Parameters: |
---|
Make the swot answer the teacher’s question. The swot’s next action will be check_eric().
Make the teacher ask a question. The swot’s next action is set to answer_question().
Returns: | A Say command. |
---|
Make the swot tell the teacher that Eric is absent (if he is). If Eric is absent, the teacher’s next action will be fetch_eric().
Returns: | A Say command if Eric is absent, otherwise None. |
---|
Make the swot tell the teacher that Eric is absent (if he is). This method defines the swot’s first action during a lesson. If Eric is absent, the teacher’s next action will be fetch_eric(). The swot’s next action is set to grass_for_hitting().
Returns: | A Say command if Eric is absent, otherwise None. |
---|
Make the teacher track down Eric if he is absent. The teacher may first give lines to the swot for telling tales. If Eric is present by the time this method is called (after the swot has finished telling the teacher that Eric is not in class), the teacher will give lines to Eric for being late (or for leaving early).
Returns: | A FetchEric command if Eric is still absent after the swot has finished speaking, otherwise None. |
---|
Indicate that the current actor (teacher or swot) has finished speaking.
Return the next question for the teacher to ask in a question-and-answer session with the swot.
Make the teacher give lines to the swot for telling a tale, or give lines to the subject of the swot’s tale.
Parameters: |
|
---|
Make the teacher give lines to the swot for telling a tale about being hit, or give lines to the subject of the tale. If the swot has not told such a tale, nothing happens.
Make the teacher give lines to the swot for telling a tale about the blackboard being written on, or give lines to the subject of the tale. If the swot has not told such a tale, nothing happens. The teacher’s next action is set to wipe_board().
Make the swot tell a tale about someone hitting him (possibly). This method defines the swot’s second action during a lesson. The teacher’s next action is set to give_lines_for_hitting(). The swot’s next action is set to grass_for_writing().
Returns: | A Say command, or None if the swot decides not to tell a tale. |
---|
Make the swot tell a tale about someone writing on the blackboard (if it was written on by Eric or the tearaway). This method defines the swot’s third action during a lesson. The teacher’s next action is set to give_lines_for_writing().
Returns: | A Say command, or None if the swot decides not to tell a tale. |
---|
Return whether Eric is absent from the classroom in which this lesson is taking place.
Make a teacher join the lesson. This method is called by the teacher when he notices that the swot has sat down.
Parameters: |
|
---|
Complete any actions required of the swot, and return the next command to be executed by him, or None if it’s not his turn to act.
Complete any actions required of the teacher, and return the next command to be executed by him, or None if it’s not his turn to act.
Make the teacher return to the classroom after fetching Eric. The teacher’s next action will be ask_question() (if a question-and-answer session was interrupted) or walk_up_or_down().
Returns: | A GoToXY command. |
---|
Switch turns between the actors in this lesson (the teacher and the swot).
Parameters: | action – The next action (method to execute) for the next actor; if None, the next action (which may have already been set) is unchanged. |
---|
Make the teacher tell the class what to do (as opposed to starting a question-and-answer session with the swot). The teacher’s next action (and base action for the remainder of the lesson) will be walk_up_or_down().
Returns: | A TellClassWhatToDo command. |
---|
Make the teacher walk to the middle of the blackboard (after having wiped it). The teacher’s next action will be write_on_board().
Returns: | A GoToXY command. |
---|
Make the teacher walk up or down in front of the blackboard. This action is used during a lesson with no question-and-answer session. The swot’s next action is set to check_eric().
Returns: | A WalkUpOrDown command. |
---|
Make the teacher wipe the board (if there is one). The teacher’s next action will be walk_to_board().
Returns: | A WipeBoard command if there is a blackboard, None otherwise. |
---|
Make the teacher write on the blackboard (possibly). The teacher’s next action will be the base action for this lesson (either tell_class_what_to_do() or ask_question()).
Returns: | A WriteOnBoard command if the teacher chooses to write, otherwise None. |
---|
Generates questions and answers for the teacher and swot to use during a lesson. Every teacher gets his own generator to keep; it is built before the game starts.
Add an answer to a question.
Parameters: |
|
---|
Add a Q&A pair to a Q&A group.
Parameters: |
|
---|
Add a question to a Q&A group.
Parameters: |
|
---|
Return whether the teacher has a special question. A special question is one to which the answer must be seen written on a blackboard by the teacher to make him reveal his safe combination letter.
Initialise the answer to the teacher’s special question (if there is one). The special answer is chosen at random from the Q&A pairs in the Q&A group of the special question.
Prepare a randomly chosen question and answer.
Parameters: | qa_group – The Q&A group from which to choose the question and answer; if None, the Q&A group will be chosen at random from those available. |
---|---|
Returns: | A 2-tuple containing the question and the answer. |
Prepare the teacher’s special question and answer (if any).
Returns: | A 2-tuple containing the question and the answer. |
---|
Set the Q&A group to use for the teacher’s special question (if there is one).
Parameters: |
|
---|