예제 #1
0
 def noLoops(self):
     map_array = ['###############',
                  '#  #@#I  T$#  #',
                  '#  #    IB #  #',
                  '#  #     W #  #',
                  '#  #      ##  #',
                  '#  #B XBN# #  #',
                  '#  ##      #  #',
                  '#  #       #  #',
                  '#  #     W #  #',
                  '#  #      ##  #',
                  '#  #B XBN# #  #',
                  '#  ##      #  #',
                  '#  #       #  #',
                  '#  #     W #  #',
                  '#  #      ##  #',
                  '#  #B XBN# #  #',
                  '#  ##      #  #',
                  '#  #       #  #',
                  '#  #       #  #',
                  '#  #      ##  #',
                  '#  #  XBIT #  #',
                  '#  #########  #',
                  '#             #',
                  '# ##### ##### #',
                  '# #     #     #',
                  '# #     #  ## #',
                  '# #     #   # #',
                  '# ##### ##### #',
                  '#             #',
                  '###############']
     lines = 30
     columns = 15
     actions = bender.process(map_array, lines, columns)
     self.assertEquals('SOUTH', actions[0])
예제 #2
0
 def testObstacleEastToSouth(self):
     map_array = ['####',
                  '#@ X',
                  '##$#']
     lines = 3
     columns = 4
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['EAST', 'SOUTH'], actions)
예제 #3
0
 def testLoopDetect(self):
     map_array = ['#####',
                  '#$  #',
                  '#   #',
                  '#@  #',
                  '#####']
     lines = 5
     columns = 5
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['LOOP'], actions)
예제 #4
0
 def testSimpleSouth(self):
     map_array = ['#####',
                  '#@  #',
                  '#   #',
                  '#$  #',
                  '#####']
     lines = 5
     columns = 5
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['SOUTH', 'SOUTH'], actions)
예제 #5
0
 def testExample(self):
     map_array = ['######',
                  '#@E $#',
                  '# N  #',
                  '#X   #',
                  '######']
     lines = 5
     columns = 6
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['SOUTH', 'EAST',
                        'NORTH', 'EAST',
                        'EAST'], actions)
예제 #6
0
 def testBreaker(self):
     map_array = ['#######',
                  '#@    #',
                  '#B    #',
                  '#X    #',
                  '#$    #'
                  '#######']
     lines = 5
     columns = 7
     actions = bender.process(map_array, lines, columns)
     expected = ['SOUTH', 'SOUTH', 'SOUTH']
     self.assertEquals(expected, actions)
예제 #7
0
 def testCase2(self):
     map_array = ['########',
                  '# @    #',
                  '#     X#',
                  '# XXX  #',
                  '#   XX #',
                  '#   XX #',
                  '#     $#',
                  '########']
     lines = 8
     columns = 8
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['SOUTH', 'EAST',
                        'EAST', 'EAST', 'SOUTH',
                        'EAST', 'SOUTH',
                        'SOUTH', 'SOUTH'], actions)
예제 #8
0
 def testpathModifier(self):
     map_array = ['##########',
                  '#        #',
                  '#  S   W #',
                  '#        #',
                  '#  $     #',
                  '#        #',
                  '#@       #',
                  '#        #',
                  '#E     N #',
                  '##########']
     lines = 10
     columns = 10
     actions = bender.process(map_array, lines, columns)
     expected = ['SOUTH', 'SOUTH', 'EAST', 'EAST', 'EAST', 'EAST', 'EAST',
                 'EAST',
                 'NORTH', 'NORTH', 'NORTH', 'NORTH', 'NORTH', 'NORTH',
                 'WEST', 'WEST', 'WEST', 'WEST', 'SOUTH', 'SOUTH']
     self.assertEquals(expected, actions)
예제 #9
0
 def testInverter(self):
     map_array = ['##########',
                  '#    I   #',
                  '#        #',
                  '#       $#',
                  '#       @#',
                  '#        #',
                  '#       I#',
                  '#        #',
                  '#        #',
                  '##########']
     lines = 10
     columns = 10
     actions = bender.process(map_array, lines, columns)
     self.assertEquals(['SOUTH', 'SOUTH', 'SOUTH', 'SOUTH', 'WEST',
                        'WEST', 'WEST', 'WEST', 'WEST',
                        'WEST', 'WEST', 'NORTH',
                        'NORTH', 'NORTH', 'NORTH', 'NORTH', 'NORTH',
                        'NORTH',
                        'EAST', 'EAST', 'EAST', 'EAST', 'EAST',
                        'EAST', 'EAST', 'SOUTH', 'SOUTH'], actions)
예제 #10
0
    def testBreakerLoop(self):
        map_array = ['##########',
                     '#        #',
                     '#  @     #',
                     '#  B     #',
                     '#  S   W #',
                     '# XXX    #',
                     '#  B   N #',
                     '# XXXXXXX#',
                     '#       $#',
                     '##########']

        lines = 10
        columns = 10
        actions = bender.process(map_array, lines, columns)
        expected = ['SOUTH', 'SOUTH', 'SOUTH', 'SOUTH',
                    'EAST', 'EAST', 'EAST', 'EAST',
                    'NORTH', 'NORTH', 'WEST', 'WEST',
                    'WEST', 'WEST', 'SOUTH', 'SOUTH',
                    'SOUTH', 'SOUTH',
                    'EAST', 'EAST', 'EAST', 'EAST', 'EAST']
        self.assertEquals(expected, actions)