Samurai followed a code called Bushido. The code made samurai have total loyalty to there daimyo, to honor there lord and themselves, and to learn martial arts. To honor the Bushido, in battle, instead of being captured or losing they committed suicide to have a honorable death, and to follow the bushido.