From fd8dfc369122c5d2ce901e8845d6c237537e0217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20G=C3=B6r?= Date: Tue, 27 Jun 2023 18:25:57 +0300 Subject: [PATCH] aggregation 3 --- python-temel/aggregation.3.py | 25 +++++++++++++++++++++++++ python-temel/aggregation.3.py~ | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 python-temel/aggregation.3.py create mode 100644 python-temel/aggregation.3.py~ diff --git a/python-temel/aggregation.3.py b/python-temel/aggregation.3.py new file mode 100644 index 0000000..9770bcb --- /dev/null +++ b/python-temel/aggregation.3.py @@ -0,0 +1,25 @@ +class Figure: + def __init__(self, ftype, color): + self.ftype = ftype + self.color = color + +class Square: + def __init__(self, color): + self.color = color + self.figure = None + + def set_figure(self, figure): + self.figure = figure + + def get_figure(self): + return self.figure + +class Board: + def __init__(self): + self.squares = [[Square('Beyaz' if (i + k) % 2 == 0 else 'Siyah' ) for i in range(8)] for k in range(8)] + self.squares[0][0].figure = Figure('Kale', 'Siyah') + self.squares[0][1].figure = Figure('At', 'Siyah') + # .... + +board = Board() +#print(board) diff --git a/python-temel/aggregation.3.py~ b/python-temel/aggregation.3.py~ new file mode 100644 index 0000000..b2f4522 --- /dev/null +++ b/python-temel/aggregation.3.py~ @@ -0,0 +1,24 @@ +class Figure: + def __init__(self, ftype, color): + self.ftype = ftype + self.color = color + +class Square: + def __init__(self, color): + self.color = color + self.figure = None + + def set_figure(self, figure): + self.figure = figure + + def get_figure(self): + return self.figure + +class Board: + def __init__(self): + self.squares = [[Square('Beyaz' if (i + k) % 2 == 0 else 'Siyah' ) for i in range(8)] for k in range(8)] + self.squares[0][0].figure = Figure('Kale', 'Siyah') + self.squares[0][1].figure = Figure('At', 'Siyah') + # .... + +board = Board()