Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor snake game #412

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

Closed
partrita wants to merge 7 commits into larymak:main from partrita:refactor-snake-game
Closed
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
The table of contents is too big for display.
Diff view
Diff view
92 changes: 42 additions & 50 deletions ART SCRIPTS/Draw python logo using python/main.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import turtle as t
'''Author: Rajarshi Banerjee | GSAUC3'''

"""Author: Rajarshi Banerjee | GSAUC3"""


class logo:

def __init__(i,t) -> None:
i.t=t
def __init__(i,t) -> None:
i.t = t

def blue_part(i):
i.t.penup()
# d = 200
# x = 10
i.t.pencolor('blue')
i.t.color('blue')
i.t.goto(-110,-100)

# d = 200
# x = 10
i.t.pencolor("blue")
i.t.color("blue")
i.t.goto(-110,-100)
i.t.pendown()
i.t.begin_fill()
i.t.right(180)
i.t.forward(100/3)
i.t.forward(100 / 3)

for _ in range(5):
i.t.right(15)
Expand All @@ -30,15 +33,13 @@ def blue_part(i):
for _ in range(5):
i.t.right(15)
i.t.forward(15)



i.t.goto(0,100)
i.t.goto(0,110)
i.t.goto(-100,110)
i.t.goto(-100,110+100/3)

i.t.goto(0, 100)
i.t.goto(0, 110)
i.t.goto(-100, 110)
i.t.goto(-100, 110 + 100 / 3)
i.t.left(90)

for _ in range(5):
i.t.right(15)
i.t.forward(15)
Expand All @@ -52,35 +53,33 @@ def blue_part(i):
i.t.right(15)
i.t.forward(15)

i.t.forward(60+10)

i.t.forward(60 + 10)

for _ in range(5):
i.t.right(15)
i.t.forward(15)

i.t.right(5)
i.t.goto(-100+30,10)
i.t.goto(-100 + 30,10)


for _ in range(5):
i.t.left(15)
i.t.forward(15)
i.t.left(5)

i.t.goto(-110,-100)
i.t.goto(-110,-100)
i.t.end_fill()

def yellow_part(i):
i.t.penup()
i.t.pencolor('yellow')
i.t.color('yellow')
i.t.goto(110,100)
i.t.pencolor("yellow")
i.t.color("yellow")
i.t.goto(110,100)
i.t.right(90)
i.t.pendown()
i.t.begin_fill()
i.t.right(180)
i.t.forward(100/3)
i.t.forward(100 / 3)

for _ in range(5):
i.t.right(15)
Expand All @@ -94,15 +93,13 @@ def yellow_part(i):
for _ in range(5):
i.t.right(15)
i.t.forward(15)



i.t.goto(0,-100)
i.t.goto(0,-110)
i.t.goto(100,-110)
i.t.goto(100,-110-100/3)

i.t.goto(0, -100)
i.t.goto(0, -110)
i.t.goto(100, -110)
i.t.goto(100, -110 - 100 / 3)
i.t.left(90)

for _ in range(5):
i.t.right(15)
i.t.forward(15)
Expand All @@ -116,52 +113,47 @@ def yellow_part(i):
i.t.right(15)
i.t.forward(15)

i.t.forward(60+10)

i.t.forward(60 + 10)

for _ in range(5):
i.t.right(15)
i.t.forward(15)

i.t.right(5)
i.t.goto(70,-10)
i.t.goto(70,-10)


for _ in range(5):
i.t.left(15)
i.t.forward(15)
i.t.left(5)

i.t.goto(110,100)
i.t.goto(110,100)
i.t.end_fill()



def eyes(i):
i.t.penup()
i.t.color('white')
i.t.goto(-70,130)
i.t.color("white")
i.t.goto(-70,130)
i.t.pendown()
i.t.begin_fill()
i.t.circle(10)
i.t.end_fill()

i.t.penup()
i.t.color('white')
i.t.goto(70+20,-130)
i.t.color("white")
i.t.goto(70 + 20,-130)
i.t.pendown()
i.t.begin_fill()
i.t.circle(10)
i.t.end_fill()

i.t.hideturtle()



if __name__ =="__main__":
if __name__ =="__main__":
t.Turtle()
obj=logo(t)
obj = logo(t)
obj.blue_part()
obj.yellow_part()
obj.eyes()
t.done()

2 changes: 1 addition & 1 deletion ART SCRIPTS/Images to PDF/images-to-pdf.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#a script that converts images to pdf
#a script that converts images to pdf

from reportlab.platypus import Image, SimpleDocTemplate

Expand Down
4 changes: 2 additions & 2 deletions ART SCRIPTS/image-ascii/image.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pywhatkit
pywhatkit.image_to_ascii_art(
'flo.jpg', 'flo.text')

pywhatkit.image_to_ascii_art("flo.jpg", "flo.text")
14 changes: 7 additions & 7 deletions ART SCRIPTS/pencilSketch/main.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import cv2

#reading image
#reading image
image = cv2.imread("res/girl3.jpg")

#converting BGR image to grayscale
#cvtColor -> https://docs.opencv.org/3.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab
#converting BGR image to grayscale
#cvtColor -> https://docs.opencv.org/3.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

#image invert
#image invert
inverted_image = 255 - gray_image

#blurring image
#GaussianBlur -> https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1
#blurring image
#GaussianBlur -> https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1
blurred_image = cv2.GaussianBlur(gray_image, (43, 43), 0)
pencil_sketch = cv2.divide(gray_image, blurred_image, scale=250.0)

cv2.imshow("Original Image", image)
cv2.imshow("Pencil Sketch", pencil_sketch)
cv2.waitKey(0)
cv2.waitKey(0)
7 changes: 4 additions & 3 deletions AUDIO RELATED SCRIPTS/Audio Captcha Generator/code.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from captcha.audio import AudioCaptcha
from random import randint

audio = AudioCaptcha()
num = randint(100000,999999)
num = randint(100000,999999)
data = audio.generate(str(num))
audio.write(str(num), str(num)+'.mp3')
print(num)
audio.write(str(num), str(num) + ".mp3")
print(num)
2 changes: 1 addition & 1 deletion AUDIO RELATED SCRIPTS/AudioBuk/audio.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
text = page.extractText()
speak = pyttsx3.init()
speak.say(text)
speak.runAndWait()
speak.runAndWait()
38 changes: 19 additions & 19 deletions AUDIO RELATED SCRIPTS/audiobookfinder/audiobookfinder.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
from bs4 import BeautifulSoup
import requests


import webbrowser


import webbrowser


booklinks = []
booktitles = []


def findfromgoldenaudiobooks(bookname):
URL = "https://goldenaudiobooks.com/?s="
r = requests.get(URL + bookname)
soup = BeautifulSoup(r.content, 'html5lib')
booklist = soup.findAll('h2', attrs = {'class':'entry-title'})
soup = BeautifulSoup(r.content, "html5lib")
booklist = soup.findAll("h2", attrs={"class": "entry-title"})

for book in booklist:
booklinks.append(book.a['href'])
booklinks.append(book.a["href"])
booktitles.append(book.a.text)


def findfromfindaudiobooks(bookname):
URL = "https://findaudiobook.com/?s="
r = requests.get(URL + bookname)
soup = BeautifulSoup(r.content, 'html5lib')
booklist = soup.findAll('h2', attrs = {'class':'entry-title post-title'})
soup = BeautifulSoup(r.content, "html5lib")
booklist = soup.findAll("h2", attrs={"class": "entry-title post-title"})

for book in booklist:
booklinks.append(book.a['href'])
booklinks.append(book.a["href"])
booktitles.append(book.a.text)



def findfromfullengthaudiobooks(bookname):
URL = "https://fulllengthaudiobooks.com/?s="
r = requests.get(URL + bookname)
soup = BeautifulSoup(r.content, 'html5lib')
booklist = soup.findAll('h2', attrs = {'class':'entry-title post-title'})
soup = BeautifulSoup(r.content, "html5lib")
booklist = soup.findAll("h2", attrs={"class": "entry-title post-title"})

for book in booklist:
booklinks.append(book.a['href'])
booklinks.append(book.a["href"])
booktitles.append(book.a.text)


def findfrom101audiobooks(bookname):
URL = "https://101audiobooks.net/?s="
r = requests.get(URL + bookname)
soup = BeautifulSoup(r.content, 'html5lib')
booklist = soup.findAll('h2', attrs = {'class':'entry-title'})
soup = BeautifulSoup(r.content, "html5lib")
booklist = soup.findAll("h2", attrs={"class": "entry-title"})

for book in booklist:
booklinks.append(book.a['href'])
booklinks.append(book.a["href"])
booktitles.append(book.a.text)


search = input("search for a book ")

findfromgoldenaudiobooks(search)
Expand All @@ -59,10 +61,8 @@ def findfrom101audiobooks(bookname):
findfrom101audiobooks(search)

for x in range(1, len(booktitles) + 1):
print(str(x) + ": " + booktitles[x-1])
print(str(x) + ": " + booktitles[x - 1])

booknum = int(input("select a book number "))
print("opening " + str(booklinks[booknum - 1]))
webbrowser.open(str(booklinks[booknum - 1]), new=2)


8 changes: 4 additions & 4 deletions AUDIO RELATED SCRIPTS/texttoaudio/code.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from gtts import gTTS
from playsound import playsound

audio='speech.mp3'
audio = "speech.mp3"
playsound(audio)
lang='en'
text="hELLO, OPEN SOURCE!"
sp=gTTS(text=text,lang=lang,slow=False)
lang = "en"
text = "hELLO, OPEN SOURCE!"
sp = gTTS(text=text,lang=lang,slow=False)
sp.save(audio)
7 changes: 4 additions & 3 deletions AUTOMATION/AutoMoveFiles/AutoMoveFiles.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
import os
import json


class Handler(FileSystemEventHandler):
def on_modified(self, event):
def on_modified(self, event) -> None:
for file in os.listdir(watched_folder):
src = f"{watched_folder}/{file}"
dst = f"{destination_folder}/{file}"
os.rename(src=src, dst=dst)

if __name__=="__main__":

if __name__ == "__main__":
watched_folder = input("Paste the path to the folder to be tracked: ")
destination_folder = input("Paste the path to the destination folder: ")
handler = Handler()
Expand All @@ -27,4 +29,3 @@ def on_modified(self, event):
except KeyboardInterrupt:
observer.stop()
observer.join()

11 changes: 11 additions & 0 deletions AUTOMATION/AutoMoveFiles/README_ko.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# AutoMoveFiles
스크립트는 추적된 폴더에서 대상 폴더로 파일을 자동으로 이동합니다.

## 시작하기
- `pip install watchdog` 또는 `poetry add watchdog`
- `cd AutoMoveFiles`
- `python -m AutoMoveFiles.py`
- 소스 폴더 경로 입력
> 예: `C:\Users\example\Downloads`
- 대상 폴더 경로 입력
> 예: `C:\Users\example\Documents`
Loading

AltStyle によって変換されたページ (->オリジナル) /