Hamas is following the playbook of a relatively obscure 19th century war philosopher who said, "War is merely a continuation of politics by other means". To Hamas, the absolute military result of the war is irrelevant. What is relevant is the advancement of their goal or policy of Palestinian Emancipation. If this war, even by loosing, leads to the opening of the Blockade, it would be a victory for them.
At least 1,000 Israeli Arabs protest death of Palestinian infant in deadly West Bank arson (Haaretz)