-
Notifications
You must be signed in to change notification settings - Fork 0
/
living.py
28 lines (24 loc) · 745 Bytes
/
living.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""commonn class"""
class Living(object):
"""living"""
def __init__(self, arr, x_cord, y_cord, b_s):
"""init"""
self.x_cord = x_cord
self.y_cord = y_cord
self.alive = True
self.symbol = b_s
self.position(arr, x_cord, y_cord)
def position(self, arr, x_cord, y_cord):
"""pos"""
self.x_cord = x_cord
self.y_cord = y_cord
arr[self.x_cord][self.y_cord] = self.symbol
def clear_obj(self, arr):
"""clear_obj"""
if arr[self.x_cord][self.y_cord] == self.symbol:
arr[self.x_cord][self.y_cord] = 0
def kill(self, arr, sym):
"""kill"""
self.symbol = sym
self.alive = False
self.clear_obj(arr)