Skip to content

feat: tasks from lesson 8 added #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions lesson_8/lesson8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# # Алгоритм **игры** крестики-нолики
# 1. Рисуется **поле** [создается пустая матрица]
# 2. Пока **игра** не закончена:
# 2. **Игрок** выбирает куда поставить **символ**
# 3. Проверить занята ли **клетка** \ валидный ли **ход**
# 3. Рисуется обновленное **поле**
# 4. Проверить победное **условия** \ окончания **игры**
# 5. Ход переходить другому **игроку**
# 6. Пишем кто победил
#
class Game:
def __init__(self, field_size=3):
self.field = Field(field_size)
self.player_1 = Player('X')
self.player_2 = Player('O')
self.actual_player = self.player_1

def start(self):
pass

def is_running(self):
pass

def switch_turn(self):
pass

def check_winning_condition(self):
pass


# композиция # агрегация
class Field:
def __init__(self):
pass

# def _check_if_cell_is_empty(self, coordinate):
# pass

def set_symbol(self, symbol, coordinate):
pass

def print(self):
pass

# class Cell:
# pass

class Player:
def __init__(self, symbol):
self.symbol = symbol

def make_turn(self):
pass


if __name__ == "__main__":
game = Game()
game.start()
26 changes: 26 additions & 0 deletions lesson_8/main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# tic-tac-toe
# Крестики-нолики

Принципы ООП:
- наследование
- полиморфизм
- инкапсуляция
- абстракция

банковский счет
- положить деньги
- снять деньги
- проверить баланс


class Student:
id
name
passport
group
hobbys

def func(i: int)
def func(i: str)