'Rewards the model for playing any motif.
Motif must have at least three distinct notes in the course of one bar.
There is a bonus for playing more complex motifs; that is, ones that involve
a greater number of notes.
Args:
action: One-hot encoding of the chosen action.
reward_amount: The amount that will be returned if the last note belongs
to a motif.
Returns:
Float reward value.'

def reward_motif(self, action, reward_amount=3.0):

    composition = (self.composition + [np.argmax(action)])
    (motif, num_notes_in_motif) = self.detect_last_motif(composition=composition)
    if (motif is not None):
        motif_complexity_bonus = max(((num_notes_in_motif - 3) * 0.3), 0)
        return (reward_amount + motif_complexity_bonus)
    else:
        return 0.0
