In the end of the drama, it is up to the viewer to decide whether what the teacher did was for the benefit of the students or for his own sadistic pleasures. What do you think? 

According to me, the teacher was not completely a bad person. He was trying to teach the students a lesson by giving them what they want and making them experience the consequences of their choices.