Skip to content

Instantly share code, notes, and snippets.

View ashtanyuk's full-sized avatar

Anton A. Shtanyuk ashtanyuk

View GitHub Profile
@ashtanyuk
ashtanyuk / Student.py
Created March 22, 2023 16:53
Student
import datetime
class Student():
def __init__(self, name, dob, number):
self.name = name
self.birth_date = dob
self.phone_number = number
def age_calculator(self):
current_date = datetime.datetime.now().date()
@ashtanyuk
ashtanyuk / TicTacToe3.py
Created January 25, 2023 17:23
Консольная версия с AI
#!/usr/bin/env python3
from math import inf as infinity
from random import choice
import platform
import time
from os import system
"""
An implementation of Minimax AI Algorithm in Tic Tac Toe,
using Python.
@ashtanyuk
ashtanyuk / TicTacToe2.py
Created January 25, 2023 17:23
Графическая версия без AI
from tkinter import *
from tkinter import messagebox
Player1 = 'X'
stop_game = False
def clicked(r, c):
# player
global Player1
@ashtanyuk
ashtanyuk / TicTacToe1.py
Created January 25, 2023 17:04
Консольная версия без AI
import random
class TicTacToe:
def __init__(self):
self.board = []
def create_board(self):
for i in range(3):
@ashtanyuk
ashtanyuk / balls.py
Created January 25, 2023 16:00
Прямоугольный бильярд
import threading
import pygame
class Ball:
xd = 1
yd = 1
def __init__(self, x, y, color, xd, yd):
self.x = x
self.y = y
self.color = color
@ashtanyuk
ashtanyuk / kerasnn.ipynb
Created January 20, 2023 12:45
KerasNN.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ashtanyuk
ashtanyuk / Car.py
Created January 18, 2023 16:15
Класс Car
class Car:
def __init__(self, speed=0):
self.speed = speed
self.odometer = 0
self.time = 0
def say_state(self):
print("I'm going {} kph!".format(self.speed))
@ashtanyuk
ashtanyuk / Employee.py
Created January 18, 2023 16:15
Расчет зарплаты сотрудникам
# Класс Employee: name, money
class Employee:
def getSalary(self):
return self.money
def setSalary(self, money):
self.money = money
def __init__(self, name):
self.name = name
@ashtanyuk
ashtanyuk / news.py
Created January 18, 2023 14:13
Список новостей сайта opennet.ru
import requests
import pandas as pd
import lxml
url = 'https://www.opennet.ru'
html = requests.get(url).content
df_list = pd.read_html(html)
news = df_list[2]
ln = list(news[2].dropna())
@ashtanyuk
ashtanyuk / ListSum.py
Created January 18, 2023 14:12
Функция, суммирующая список чисел двумя способами
# написать функцию, которая суммирует элементы списка чисел
# 1. С помощью цикла
# 2. С помощью рекурсии
def sumLoop(lst):
sum = 0
for i in lst:
sum += i
return sum