Answer:
Simile
Step-by-step explanation:
"As flies to wanton boys, are we to the gods; They kill us for their sport."
This line of thought expresses both pessimism and optimism because in as much as the gods inflict pain on we mortals this is to keep mortals to obey morals in the society.
The figurative language here is Simile