def test_inside_board_wall_multi_step_block(): envs, shared_state = setup(positions=[(1, 1)], walls=[(1, 3)]) env = envs[0] assert_position(env, shared_state, (1, 1)) env.step(FourKeysActions.RIGHT) env.step(FourKeysActions.RIGHT) assert_position(env, shared_state, (1, 2))
def test_attack_receiving_player_with_keys_unable_to_move(): envs, shared_state = setup(positions=[(1, 0), (1, 1)], walls=[(1, 3)], additional_keys=[(1, 2)]) env = envs[0] env2 = envs[1] # Fully recharge for i in range(20): env.step(FourKeysActions.NOTHING) env2.step(FourKeysActions.NOTHING) env2.step(FourKeysActions.RIGHT) # Pickup key env2.step(FourKeysActions.LEFT) env.step(FourKeysActions.ATTACK) assert env.attack_recharge == 1 assert env2.move_recharge == 0 assert_position(env2, shared_state, (1, 1), player=FourKeysBoardItems.PLAYER2) env2.step(FourKeysActions.RIGHT) assert_position(env2, shared_state, (1, 1), player=FourKeysBoardItems.PLAYER2)
def test_key_not_block(): envs, shared_state = setup(positions=[(1, 1)], walls=[(1, 3)], additional_keys=[(1, 2)]) env = envs[0] assert_position(env, shared_state, (1, 1)) env.step(FourKeysActions.RIGHT) assert_position(env, shared_state, (1, 2))
def test_inside_board_move_left_ok(): envs, shared_state = setup(positions=[(1, 1)]) env = envs[0] assert_position(env, shared_state, (1, 1)) env.step(FourKeysActions.LEFT) assert_position(env, shared_state, (1, 0))
def test_top_left_empty_move_right_ok(): envs, shared_state = setup() env = envs[0] assert_position(env, shared_state, (0, 0)) env.step(FourKeysActions.RIGHT) assert_position(env, shared_state, (0, 1))
def test_top_left_empty_move_down_ok(): envs, shared_state = setup() env = envs[0] assert_position(env, shared_state, (0, 0)) env.step(FourKeysActions.DOWN) assert_position(env, shared_state, (1, 0))