示例#1
0
	def testFindPaths(self):
		board = Board.jsonLoad("board1.json")
		paths = board.findPaths()
		self.assertTrue( [(0,5),  (1,5), (2,5), (3,5)] in paths)
		self.assertTrue( [(10,5), (9,5), (8,5), (7,5)] in paths)
		self.assertTrue( [(5,0),  (5,1), (5,2), (5,3)] in paths)
		self.assertTrue( [(5,10), (5,9), (5,8), (5,7)] in paths)
示例#2
0
	def testJsonLoadAndOrderPathSquaresByClosest(self):
		testBoard1 = Board.jsonLoad("board1.json")
		self.assertEquals(testBoard1.base,[(5, 5), (5, 6), (5, 4), (6, 5), (6, 6), (6, 4), (4, 5), (4, 6), (4, 4)])
		self.assertEquals(testBoard1.path,[(5, 7), (5, 3), (7, 5), (3, 5), (5, 8), (5, 2), (8, 5), (2, 5), (5, 9), (5, 1), (9, 5), (1, 5), (5, 10), (5, 0), (10, 5), (0, 5)])