soft internalized some methods

Have learned how to "internalize" methods 😆
This commit is contained in:
otomo otonami 2022-08-15 07:29:25 +03:00
parent 446ffba554
commit 00daf53fae

View File

@ -31,11 +31,11 @@ class GameLogic():
directions = ((0, 1), (1, 0), (1,1), (-1, 1)) directions = ((0, 1), (1, 0), (1,1), (-1, 1))
for mark in markList: for mark in markList:
for direction in directions: for direction in directions:
if self.is_line(markList, mark, direction): if self._is_line(markList, mark, direction):
return player return player
return False return False
def is_line(self, markList, mark, direction): # INTERNAL, I guess. def _is_line(self, markList, mark, direction):
for i in range(1, self.winRowLength): for i in range(1, self.winRowLength):
seeked = (mark[0] + direction[0] * i, mark[1] + direction[1] * i) seeked = (mark[0] + direction[0] * i, mark[1] + direction[1] * i)
if seeked in markList: if seeked in markList: