Example #1
0
 def test_probable_transitions_inner(self):
     model = HMM(8, 8)
     inner = (3, 3, Direction.WEST)
     expected = [((4, 3, Direction.SOUTH), 0.1),
                 ((4, 3, Direction.NORTH), 0.1),
                 ((4, 3, Direction.EAST), 0.1),
                 ((4, 3, Direction.WEST), 0.7),
                 ]
     self.assertEqual(sorted(model.probable_transitions(inner)),
                      sorted(expected))
Example #2
0
 def test_probable_transitions_one_away_from_wall(self):
     model = HMM(8, 8)
     one_away = (7, 6, Direction.SOUTH)
     expected = [((7, 7, Direction.SOUTH), 0.7),
                 ((7, 7, Direction.NORTH), float(1) / 2),
                 ((7, 7, Direction.EAST), float(1) / 2),
                 ((7, 7, Direction.WEST), 0.1),
                 ]
     self.assertEqual(sorted(model.probable_transitions(one_away)),
                      sorted(expected))
Example #3
0
 def test_probable_transitions_wall(self):
     model = HMM(8, 8)
     wall = (3, 7, Direction.EAST)
     expected = [((2, 7, Direction.NORTH), float(1) / 3),
                 ((2, 7, Direction.SOUTH), 0.1),
                 ((2, 7, Direction.EAST), 0.7),
                 ((2, 7, Direction.WEST), 0.1),
                 ]
     self.assertEqual(sorted(model.probable_transitions(wall)),
                      sorted(expected))
Example #4
0
 def test_probable_transitions_corner(self):
     model = HMM(8, 8)
     corner = (7, 0, Direction.SOUTH)
     expected = [((7, 1, Direction.SOUTH), 0.7),
                 ((7, 1, Direction.NORTH), 0.1),
                 ((7, 1, Direction.EAST), float(1) / 3),
                 ((7, 1, Direction.WEST), 0.1),
                 ]
     self.assertEqual(sorted(model.probable_transitions(corner)),
                      sorted(expected))
Example #5
0
 def test_probable_transitions_inner(self):
     model = HMM(8, 8)
     inner = (3, 3, Direction.WEST)
     expected = [
         ((4, 3, Direction.SOUTH), 0.1),
         ((4, 3, Direction.NORTH), 0.1),
         ((4, 3, Direction.EAST), 0.1),
         ((4, 3, Direction.WEST), 0.7),
     ]
     self.assertEqual(sorted(model.probable_transitions(inner)),
                      sorted(expected))
Example #6
0
 def test_probable_transitions_one_away_from_wall(self):
     model = HMM(8, 8)
     one_away = (7, 6, Direction.SOUTH)
     expected = [
         ((7, 7, Direction.SOUTH), 0.7),
         ((7, 7, Direction.NORTH), float(1) / 2),
         ((7, 7, Direction.EAST), float(1) / 2),
         ((7, 7, Direction.WEST), 0.1),
     ]
     self.assertEqual(sorted(model.probable_transitions(one_away)),
                      sorted(expected))
Example #7
0
 def test_probable_transitions_wall(self):
     model = HMM(8, 8)
     wall = (3, 7, Direction.EAST)
     expected = [
         ((2, 7, Direction.NORTH), float(1) / 3),
         ((2, 7, Direction.SOUTH), 0.1),
         ((2, 7, Direction.EAST), 0.7),
         ((2, 7, Direction.WEST), 0.1),
     ]
     self.assertEqual(sorted(model.probable_transitions(wall)),
                      sorted(expected))
Example #8
0
 def test_probable_transitions_corner(self):
     model = HMM(8, 8)
     corner = (7, 0, Direction.SOUTH)
     expected = [
         ((7, 1, Direction.SOUTH), 0.7),
         ((7, 1, Direction.NORTH), 0.1),
         ((7, 1, Direction.EAST), float(1) / 3),
         ((7, 1, Direction.WEST), 0.1),
     ]
     self.assertEqual(sorted(model.probable_transitions(corner)),
                      sorted(expected))
Example #9
0
 def test_probably_transitions_edge(self):
     model = HMM(3, 3)
     edge = (0, 0, Direction.EAST)
     expected = []
     self.assertEqual(model.probable_transitions(edge), expected)
Example #10
0
 def test_probably_transitions_edge(self):
     model = HMM(3, 3)
     edge = (0, 0, Direction.EAST)
     expected = []
     self.assertEqual(model.probable_transitions(edge), expected)