def __init__(self, name=None, ico="·", team="neutral", location=None, matrix=None, position=None): Figure.__init__(self) self.name = name self.ico = ico self.move_list = [] self.team = team self.location = location #top bottom self.position = position self.matrix = matrix self.priority = False self.algorithm = [ Point(1, 1), Point(-1, 1), Point(-1, -1), Point(1, -1), "next", Point(1, 1), Point(1, -1) ] if location == "top": self.algorithm = self.reverse(self.algorithm)
class FiguresTests(unittest.TestCase): def setUp(self): self.data = \ {"type": "square", "center_x": 0, "center_y": 0, "side": 2, "color": "black"} self.new_figure = Figure(turtle_renderer, **self.data) def tearDown(self): del self.data del self.new_figure def test_figure_init(self): self.assertEquals(self.new_figure.center_y, 0) self.assertEquals(self.new_figure.center_x, 0) def test_figures_check_data(self): test1= self.new_figure._check_data(self.data) test2 = self.new_figure._check_data({}) self.assertEquals(True, test1) self.assertEquals(False, test2)
def setUp(self): self.data = \ {"type": "square", "center_x": 0, "center_y": 0, "side": 2, "color": "black"} self.new_figure = Figure(turtle_renderer, **self.data)
def __init__(self): Figure.__init__(self) self.name = "Checker" self.ico = "o" self.move_algorithm = [(1, 1), (-1, 1), (-1, -1), (1, -1)] self.kill_algorithm = [(2, 2), (-2, 2), (-2, -2), (2, -2)]
def __init__(self, name, ico, team): Figure.__init__(self) self.name = "Empty" self.ico = "·" self.team = "free"