Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a408ced
написал свой первый скрипт
Matvey2-28 Sep 17, 2025
5ec46ed
задание 1
Matvey2-28 Sep 17, 2025
2f4b3e5
изменение 1 задания
Matvey2-28 Sep 24, 2025
0484ee3
зад.2.1
Matvey2-28 Sep 24, 2025
d536169
зад. 2.2
Matvey2-28 Sep 24, 2025
aae754a
зад. 2.3
Matvey2-28 Sep 24, 2025
4254cec
зад. 2.4
Matvey2-28 Sep 24, 2025
f922b66
Del
Matvey2-28 Sep 24, 2025
3fdf298
OOP
Matvey2-28 Oct 11, 2025
5ec0ad9
задача 1 по ооп
Matvey2-28 Oct 25, 2025
29602bb
Add files via upload
Matvey2-28 Oct 25, 2025
a1583fe
изменения
Matvey2-28 Nov 1, 2025
850d3e4
первично сделал задание по ооп
Matvey2-28 Nov 7, 2025
ab37b73
изменения
Matvey2-28 Nov 8, 2025
b8165c5
еще изменения
Matvey2-28 Nov 9, 2025
222c80e
сделал архитектуру доп задания по ооп
Matvey2-28 Nov 14, 2025
58e9162
изменения
Matvey2-28 Nov 14, 2025
9a56aee
changes
Matvey2-28 Nov 15, 2025
8ecc347
добавил файлы
Matvey2-28 Nov 15, 2025
a1089d2
Add files via upload
Matvey2-28 Nov 22, 2025
e835d9c
потихоньку реализуем игру
Matvey2-28 Nov 22, 2025
b93d875
изменения
Matvey2-28 Nov 29, 2025
a915055
Delete task_1_dop_oop.py
Matvey2-28 Nov 29, 2025
1279238
ЕЩЕ НЕМНОГО ИЗМЕНЕНИЙ
Matvey2-28 Nov 29, 2025
6c469e6
изменения
Matvey2-28 Dec 5, 2025
5fe3964
еще изменения
Matvey2-28 Dec 7, 2025
6c7efdf
доработал все ошибки
Matvey2-28 Dec 13, 2025
a801133
окончательное изменение
Matvey2-28 Dec 13, 2025
f48b1ee
доработанная часть игры
Matvey2-28 Dec 19, 2025
e13987c
окончательное завершение игры
Matvey2-28 Dec 19, 2025
3279ae1
чуть изменений
Matvey2-28 Dec 27, 2025
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
Binary file added __pycache__/dragon.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/dragon.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/hero.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/hero.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/npc.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/npc.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/player.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/player.cpython-313.pyc
Binary file not shown.
Binary file added __pycache__/skeleton.cpython-311.pyc
Binary file not shown.
Binary file added __pycache__/skeleton.cpython-313.pyc
Binary file not shown.
12 changes: 12 additions & 0 deletions dragon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# import time
# from hero import Hero


class Dragon:

def __init__(self, dragon_name):
self.dragon_name = dragon_name
self.dragon_hp = 5000
self.dragon_dm = 100
self.hl = 300

120 changes: 120 additions & 0 deletions hero.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import time
import random as rd

class Hero:

def __init__(self, name):
self.name = name
self.hero_hp = 15000
self.hero1_hp = 15000
self.kills_count_with_dragon = 0
self.deaths_count_with_dragon = 0
self.kills_count_with_skelet = 0
self.deaths_count_with_skelet = 0


def attack_with_dragon(self, npc, dragon):

while npc.npc_hp > 0 and self.hero_hp > 0:
time.sleep(1)
hero_damage = rd.randrange(100, 500, 50) + dragon.dragon_dm
npc.npc_hp -= hero_damage
print(f'{self.name} и {dragon.dragon_name} атакуют {npc.npc}!')
print(f'Здоровье врага: {npc.npc_hp + hero_damage} - {hero_damage} = {npc.npc_hp}')

if npc.npc_hp <= 0:
self.kills_count_with_dragon += 1
print('Твой герой одержал победу!')
break

npc_damage = npc.npc_dm
self.hero_hp -= npc_damage
print(f'\t {npc.npc} атакует {self.name}!')
print(f'\t Здоровье героя: {self.hero_hp + npc_damage} - {npc_damage} = {self.hero_hp}')

if self.hero_hp <= 0:
self.deaths_count_with_dragon += 1
print('Герой погиб!')
break



def attack_with_skeleton(self, npc, skeleton):

while npc.npc_hp > 0 and self.hero_hp > 0:
time.sleep(1)
hero_damage = rd.randrange(100, 500, 50) + skeleton.skelet_dm
npc.npc_hp -= hero_damage
print(f'{self.name} и {skeleton.skelet_name} атакуют {npc.npc}!')
print(f'Здоровье врага: {npc.npc_hp + hero_damage} - {hero_damage} = {npc.npc_hp}')

if npc.npc_hp <= 0:
self.kills_count_with_skelet += 1
print('Твой герой одержал победу!')
break

npc_damage = npc.npc_dm
self.hero_hp -= npc_damage
print(f'\t {npc.npc} атакует {self.name}!')
print(f'\t Здоровье героя: {self.hero_hp + npc_damage} - {npc_damage} = {self.hero_hp}')

if self.hero_hp <= 0:
self.deaths_count_with_skelet += 1
print('Герой погиб!')
break


def healing(self, dragon):

if self.hero_hp < 15000:
while self.hero_hp < 15000:
time.sleep(1)
self.hero_hp += dragon.hl
self.hero1_hp = self.hero_hp
print(f'Герой восстанавливает здоровье: {self.hero_hp - dragon.hl} + {dragon.hl} = {self.hero_hp}')

if self.hero_hp >= 15000:

if self.hero_hp > 15000:
self.hero_hp = 15000
self.hero1_hp = 15000
print(f'Герой восстановил здоровье: {self.hero1_hp}')
break

elif self.hero_hp == 15000 or self.hero_hp > 15000:
print('Герой не нуждается в лечении')
self.hero_hp = 15000
self.hero1_hp = 15000


def revival(self):

if self.hero_hp <= 0:
self.hero_hp = 15000
self.hero1_hp = self.hero_hp
print('Герой возродился!')

elif self.hero_hp > 0 and self.hero_hp < 15000:
print('Ваш герой жив, но нуждается в восстановлении здоровья')

elif self.hero_hp == 15000:
print('Ваш герой жив')


def go_outside(self):
print('Ты снаружи')


def go_in_castle(self):
print('Ты в замке')


def check_hero_statistics(self, dragon, skeleton):
print('________Статистика Героя________')
print(f'Hero: {self.name}')
print(f'\t Health: {self.hero1_hp}')
print(f'\t Monsters: {dragon.dragon_name}, {skeleton.skelet_name}')
print(f'\t Kills: {self.kills_count_with_dragon + self.kills_count_with_skelet}')
print(f'\t Deaths: {self.deaths_count_with_dragon + self.deaths_count_with_skelet}')
print('________________________________')

8 changes: 8 additions & 0 deletions lec_create_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

class Ball:
pass
obj1=Ball()
ball_1=Ball()
ball_2=Ball()
print(dir (ball_1))
print(dir(int))
11 changes: 11 additions & 0 deletions lec_dinamic_fils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Ball:
def __init__(self, mass):

self.mass=mass
self.image='hexagone'

ball=Ball(0.5)
print(ball.image)
print(ball.mass)
ball.image='lines'
print(ball.image)
5 changes: 5 additions & 0 deletions lec_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Ball:
def __init__(self):
print('я вызвался')
ball=Ball()
ball2=Ball()
18 changes: 18 additions & 0 deletions lec_static_fils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Ball:
color='red'
radius=5

ball=Ball()
print(ball.color)
print(Ball.radius)

ball.color='white'
print(ball.color)
print(Ball.color)
Ball.color='white'
new_ball=Ball()
print(Ball.color)
print(new_ball.color)
new_ball.radius=10
print(new_ball.radius)
print(ball.radius)
33 changes: 33 additions & 0 deletions lec_user_metods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class Ball:

def __init__(self,mass):

self.mass=mass
self.image='hexagone'
self.x=0
self.y=0
def drop(self):
print('я подбросился')
self.y=2

def kick(self):
print('я пнулся')
self.x += 1

def fail(self):
self.mass=self.mass-0.1

ball=Ball(0.5)
ball.drop()
ball.kick()
ball.fail()
print(ball.x)
print(ball.mass)
ball.kick()
ball.kick()
ball.kick()
ball.kick()
ball.kick()
ball.kick()
ball.kick()
print(ball.x)
26 changes: 26 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import time
from dragon import Dragon
from hero import Hero
from skeleton import Skeleton
from npc import NPC
from player import Player

pl = Player('red', 'Matvey_pro')
hero = Hero('Makanchik')
dragon1 = Dragon('Leviathan')
skelet1 = Skeleton('Varior')
npc = NPC('Hog Rider')

npc1 = NPC('Hog Rider')

npc2 = NPC('Hog Rider 2')

hero.go_in_castle()
hero.go_outside()
hero.healing(dragon1)
hero.attack_with_dragon(npc1, dragon1)
hero.healing(dragon1)
hero.attack_with_skeleton(npc2, skelet1)

hero.revival()
hero.check_hero_statistics(dragon1, skelet1)
10 changes: 10 additions & 0 deletions npc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class NPC:

def __init__(self, npc):
self.npc = npc
self.npc_hp = 15000
self.npc_dm = 300




6 changes: 6 additions & 0 deletions player.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Player:

def __init__(self, color, nik):
self.color = color
self.nik = nik

6 changes: 6 additions & 0 deletions skeleton.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Skeleton:

def __init__(self, skelet_name):
self.skelet_name = skelet_name
self.skelet_hp = 7000
self.skelet_dm = 200
70 changes: 70 additions & 0 deletions task_1_oop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
class Journal:

def __init__(self, klass):
self.klass = klass
self.stud_list = {}


def add_student(self, students):
for i in range(len(students)):

self.stud_list[students[i]] = {}


def add_subjects(self, subject):
self.subject = subject

for student in self.stud_list:
self.stud_list[student][subject] = []


def rate_students(self, fio, subject, mark):
self.stud_list[fio][subject].append(mark)


def print_statistics(self, fio, subject):
print(self.stud_list[fio][subject])


def print_middle(self, fio, subject):
print(round(sum(self.stud_list[fio][subject]) / len(self.stud_list[fio][subject]), 2))


def test(self):
print(self.stud_list)


clas1 = Journal('10-И')
clas1.add_student(['Петр', 'Макан Маканов', 'Антон'])
clas1.add_subjects('Информатика')
clas1.add_subjects('Физика')

clas1.rate_students('Петр', 'Физика', 5)
clas1.rate_students('Петр', 'Физика', 4)
clas1.rate_students('Петр', 'Физика', 3)
clas1.rate_students('Петр', 'Информатика', 1)
clas1.rate_students('Петр', 'Физика', 5)
clas1.rate_students('Петр', 'Физика', 2)
clas1.rate_students('Петр', 'Физика', 2)
clas1.rate_students('Петр', 'Информатика', 5)
clas1.rate_students('Петр', 'Физика', 4)

clas1.print_statistics('Петр', 'Информатика')
clas1.print_middle('Петр', 'Информатика')

clas1.print_statistics('Петр', 'Физика')
clas1.print_middle('Петр', 'Физика')

clas1.test()












7 changes: 7 additions & 0 deletions task_2_oop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 7 18:40:29 2025

@author: 123
"""

Loading