def test_post_decrement_a(): warrior = Warrior(processes=[0]) core = Core(data=[MOV('I', '}', 1, '$', 1), DAT('F', '$', 0, '$', 0)]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert core[1].a_value() == 0 assert core[1].b_value() == 0
def test_mov_x(): warrior = Warrior(processes=[0]) core = Core(data=[ MOV('X', '$', '1', '$', '2'), DAT('F', '$', 1, '$', 7), DAT('F', '$', 0, '$', 0) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert game.core()[2].a_value() == 7 assert game.core()[2].b_value() == 1
def test_play_game_ok(): warrior_a = Warrior([MOV("I", "#", 1, "}", 0)]) warrior_b = Warrior([MOV("I", "#", 1, "}", 0)]) game = Game([warrior_a, warrior_b], max_cycles=20) game.play()
def test_game_results(): warrior_a = Warrior([MOV("I", "#", 1, "}", 0)]) warrior_b = Warrior([MOV("I", "#", 1, "}", 0)]) game = Game([warrior_a, warrior_b], max_cycles=20) game.get_results_string()
def test_round_without_gui(): warrior_a = Warrior([MOV("I", "#", 1, "}", 0)]) warrior_b = Warrior([MOV("I", "#", 1, "}", 0)]) round_obj = Round([warrior_a, warrior_b]) round_obj.play()