When Ender's Game starts, Ender is a six-year-old boy without greater knowledge. However, he has a fierce instinctual drive to survive, even if it means being brutal; he tries to keep this side of himself hidden, but he knows that because of his status as a Third child, he will be the focus of bullying and worse for his entire childhood. When he is recruited for Battle School, the teachers deliberately force harsher situations on him, forcing him to adapt and learn from his mistakes.
"Think of every stacked, impossible, unfair star arrangement you can. Think of other ways to bend the rules. Late notification. Unequal forces. Then run the simulations and see which ones are hardest, which easiest. We want an intelligent progression here. We want to bring him along."
(Card, Ender's Game, Google Books)
The Battle School continually changes the rules, putting Ender up against worse odds and taking away his advantages, and he is forced to think around their tactics in order to win. This makes him a better leader and a better tactician; when he unknowingly fights real battles, he uses those tactics to win. Ender becomes a hardened pragmatist, knowing the limits of his potential brutality but deliberately keeping it controlled. Without learning to control his anger and think logically, Ender would have lost the Bugger War.
Ender is coerced into joining the battles and through these factions loses his innocence. He would never have gone forward with killing the aliens had he not been tricked into doing so. Realizing what he had done, he lost faith in the human race as well as faith in himself. His innocence is stolen from him and he is hardened because of it. He falls into a depression because of the guilt he feels over the murders of the aliens. Through these feelings he finds hope and friendship in the aliens which later leads to his alliance with them.