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])
def testObstacleEastToSouth(self): map_array = ['####', '#@ X', '##$#'] lines = 3 columns = 4 actions = bender.process(map_array, lines, columns) self.assertEquals(['EAST', 'SOUTH'], actions)
def testLoopDetect(self): map_array = ['#####', '#$ #', '# #', '#@ #', '#####'] lines = 5 columns = 5 actions = bender.process(map_array, lines, columns) self.assertEquals(['LOOP'], actions)
def testSimpleSouth(self): map_array = ['#####', '#@ #', '# #', '#$ #', '#####'] lines = 5 columns = 5 actions = bender.process(map_array, lines, columns) self.assertEquals(['SOUTH', 'SOUTH'], actions)
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)
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)
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)
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)
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)
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)