Closed rmlarose closed 3 years ago
Noticed a failure in test_undo_entangled_measurement on PR #96 which is unrelated to quantum chess. It doesn't seem to fail often but I can reproduce it after running several times.
=================================== FAILURES =================================== _______________________ test_undo_entangled_measurement ________________________ def test_undo_entangled_measurement(): b = qb.CirqBoard(u.squares_to_bitboard(['a2','b1','c2','d1'])) assert b.perform_moves( 'b1a3c3:SPLIT_JUMP:BASIC', 'c2c4:PAWN_TWO_STEP:BASIC' ) probs = b.get_probability_distribution(1000) assert_prob_about(probs, qb.square_to_bit('a3'), 0.5) assert_prob_about(probs, qb.square_to_bit('c2'), 0.5) assert_prob_about(probs, qb.square_to_bit('c3'), 0.5) assert_prob_about(probs, qb.square_to_bit('c4'), 0.5) b.perform_moves( 'd1c2:JUMP:EXCLUDED') assert b.undo_last_move() print(b) probs = b.get_probability_distribution(1000) > assert_prob_about(probs, qb.square_to_bit('a3'), 0.5) recirq/quantum_chess/quantum_board_test.py:888: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ probs = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, ...], that = 16, expected = 0.5 atol = 0.04 def assert_prob_about(probs, that, expected, atol=0.04): """Checks that the probability is within atol of the expected value.""" assert probs[that] > expected - atol > assert probs[that] < expected + atol E assert 0.54 < (0.5 + 0.04) recirq/quantum_chess/test_utils.py:83: AssertionError ----------------------------- Captured stdout call ----------------------------- +----------------------------------+ 8| . . . . . . . . | 7| . . . . . . . . | 6| . . . . . . . . | 5| . . . . . . . . | 4| . . 54 . . . . . | 3| 54 . 46 . . . . . | 2| 100 . 46 . . . . . | 1| . . . 100 . . . . | +----------------------------------+ a b c d e f g h
@dstrain115 @cantwellc
Noticed a failure in test_undo_entangled_measurement on PR #96 which is unrelated to quantum chess. It doesn't seem to fail often but I can reproduce it after running several times.