Skip to content

Commit 06808d6

Browse files
committed
Upload day 81-99 from local repository
1 parent 95cf3e2 commit 06808d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+15789
-3
lines changed

days061-070/day070/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## [SEE HERE](https://github.com/hschickdevs/personal-developer-blog)

days081-090/day081/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Day 81 Course Assignment: Text to Morse Code Coverter
2+
3+
### See the [Project](./text-to-morse-project/) in ./text-to-morse-project/

days081-090/day082/README.md.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Day 82 Course Assignment: Portfolio Website
2+
3+
_A website to show off my skills and the projects that I've built._
4+
5+
___
6+
7+
### See my portfolio on [GitHub](https://github.com/hschickdevs)
8+
9+
### Also see my minimalistic personal websitee [here](https://github.com/hschickdevs/personal-site)

days081-090/day083/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Day 83 Course Assignment: Tic Tac Toe
2+
3+
_Build a CLI version of the Tic Tac Toe game_

days081-090/day084/Markit/demo.png

171 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
![Markit Logo](app_icon.png)
1+
![Markit Logo](Markit/app_icon.png)
22
# Markit - Image Watermarking
3-
___
3+
44
### Hi there! Thanks for checking out my `Markit` project.
55
### `Markit` is a Python program that makes watermarking images easy.
66
### This project was a completely self-written and guided course assignment in the 100 Days of Code course on Udemy.
77
### In this simple program, I mainly aim to showcase my understanding of class structure, error handling, GUIs using PySimpleGUI, and the PIL/Pillow library.
8-
### If you'd like to try this program for yourself, download the 'Markit' folder and install the pipreqs from 'requirements.txt'.
8+
### If you'd like to try this program for yourself, download the 'Markit' folder and install the pipreqs from 'requirements.txt'.
9+
10+
## Software Screenshot:
11+
12+
![Markit Demo](Markit/demo.png)

days081-090/day085/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Tactype - CLI Typing Test
2+
3+
Using Tactype, you can test your typing speed and accuracy.
4+
5+
It is a simple CLI tool that can be used to test your typing speed and accuracy. It is written in Python and uses the `curses` module to display the text to be typed.
6+
7+
## Local Setup Instructions:
8+
9+
1. Navigate to the /Tactype directory
10+
11+
2. Run the following command to install the required dependencies:
12+
13+
```bash
14+
pip install -r requirements.txt
15+
```
16+
17+
> **Note:** If you are using a UNIX-based system, you can uninstall the `windows-curses` package by running the following command: `pip uninstall windows-curses`
18+
19+
3. Run the following command to start the program:
20+
21+
```bash
22+
python main.py
23+
```
24+
25+
## Software Demo:
26+
27+
![Demo](Tactype/demo.gif)

days081-090/day085/Tactype/demo.gif

310 KB
Loading

days081-090/day085/Tactype/main.py

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name = input("Enter your name: ")
2+
input("Press enter to continue.")
3+
4+
import curses
5+
from curses import wrapper
6+
from random_word import RandomWords
7+
import time
8+
9+
r = RandomWords()
10+
11+
global wpm
12+
def start_screens(stdscr):
13+
stdscr.clear()
14+
stdscr.addstr(0,0,"Welcome to speed typing test!")
15+
stdscr.addstr(2,0,"Press any key to continue.",curses.color_pair(3))
16+
stdscr.refresh()
17+
stdscr.getkey()
18+
19+
def display(stdscr, target, current, wpm=0):
20+
stdscr.addstr(target)
21+
stdscr.addstr(2,0,f"WPM: {wpm}")
22+
23+
for i, char in enumerate(current):
24+
correct_char = target[i]
25+
color = curses.color_pair(1)
26+
if correct_char != char:
27+
color = curses.color_pair(2)
28+
29+
stdscr.addstr(0 ,i ,char, color)
30+
31+
def get_random_words(length: int = 15) -> list[str]:
32+
# Fetch random words using the random-word package
33+
return " ".join([r.get_random_word() for _ in range(length)])
34+
35+
def wpm_test(stdscr):
36+
target_text = get_random_words()
37+
current_text = []
38+
wpm = 0
39+
start_time = time.time()
40+
stdscr.nodelay(True)
41+
42+
while True:
43+
time_end = max(time.time() - start_time, 1)
44+
45+
wpm = round((len(current_text) / (time_end/60))/5)
46+
47+
stdscr.clear()
48+
display(stdscr, target_text, current_text, wpm)
49+
stdscr.refresh()
50+
51+
joined_text = "".join(current_text)
52+
if joined_text == (target_text):
53+
stdscr.nodelay(False)
54+
break
55+
56+
try:
57+
key = stdscr.getkey()
58+
except:
59+
continue
60+
61+
if ord(key) == 27:
62+
break
63+
if key in ("KEY_BACKSPACE", "\b", "\x7f"):
64+
if len(current_text) > 0:
65+
current_text.pop()
66+
elif len(current_text) < len(target_text):
67+
current_text.append(key)
68+
69+
global pk
70+
pk = wpm
71+
72+
def main(stdscr):
73+
curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
74+
curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
75+
curses.init_pair(3, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
76+
curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLACK)
77+
78+
start_screens(stdscr)
79+
80+
while True:
81+
82+
wpm_test(stdscr)
83+
stdscr.clear()
84+
85+
stdscr.addstr(f"\n*********** Score {pk} Wpm ************* ", curses.color_pair(3))
86+
stdscr.addstr(2,0,f"Congratuations you completed the test.\n", curses.color_pair(1))
87+
stdscr.addstr("\n\nPress any key to continue or 'Esc' to escape.\n\n")
88+
89+
key1 = stdscr.getkey()
90+
if ord(key1) == 27:
91+
stdscr.addstr(f"Thank you {name}.", curses.color_pair(3))
92+
stdscr.getkey()
93+
break
94+
95+
wrapper(main)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
windows-curses
2+
random-word

days081-090/day086/Breakout/ball.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from turtle import Turtle
2+
3+
4+
class Ball(Turtle):
5+
6+
def __init__(self):
7+
super().__init__()
8+
self.shape("square")
9+
self.color("blue")
10+
self.penup()
11+
self.goto(x=0, y=-280)
12+
self.x_move = 10
13+
self.y_move = 10
14+
self.move_speed = 0.1
15+
16+
def move(self):
17+
new_x = self.xcor() + self.x_move
18+
new_y = self.ycor() + self.y_move
19+
self.goto(new_x, new_y)
20+
21+
def bounce_y(self):
22+
self.y_move *= -1
23+
self.move_speed *= 0.9
24+
25+
def bounce_x(self):
26+
self.x_move *= -1
27+
28+
def reset_position(self):
29+
self.goto(0, -280)
30+
self.move_speed = 0.1
31+
self.bounce_y()

days081-090/day086/Breakout/bricks.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from turtle import Turtle
2+
3+
COLORS = ["green", "yellow", "orange"]
4+
5+
6+
class Bricks(Turtle):
7+
8+
def __init__(self):
9+
super().__init__()
10+
self.all_bricks = []
11+
self.hideturtle()
12+
13+
def create_bricks(self):
14+
15+
y = 100
16+
for color in COLORS:
17+
for row in range(2):
18+
x = -265
19+
y += 25
20+
while x < 300:
21+
22+
new_brick = Turtle("square")
23+
new_brick.penup()
24+
new_brick.shapesize(stretch_wid=1, stretch_len=3)
25+
new_brick.color(color)
26+
new_brick.goto(x, y)
27+
self.all_bricks.append(new_brick)
28+
x += 65

days081-090/day086/Breakout/main.py

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
from turtle import Screen
2+
from scoreboard import Scoreboard
3+
from ball import Ball
4+
from paddle import Paddle
5+
from bricks import Bricks
6+
import time
7+
8+
screen = Screen()
9+
screen.title("Breakout")
10+
screen.setup(width=600, height=800)
11+
screen.bgcolor("#87CEEB")
12+
screen.tracer(0)
13+
14+
scoreboard = Scoreboard()
15+
ball = Ball()
16+
paddle = Paddle((0, -300))
17+
bricks = Bricks()
18+
bricks.create_bricks()
19+
20+
screen.listen()
21+
screen.onkeypress(paddle.left, "Left")
22+
screen.onkeypress(paddle.right, "Right")
23+
24+
game_is_on = True
25+
while game_is_on:
26+
time.sleep(ball.move_speed)
27+
screen.update()
28+
ball.move()
29+
30+
# Wall Collision
31+
if ball.xcor() > 280 or ball.xcor() < -280:
32+
ball.bounce_x()
33+
34+
# Paddle Collision
35+
if ball.distance(paddle) < 30 and ball.ycor() > -300:
36+
ball.bounce_y()
37+
38+
if ball.ycor() < -300:
39+
ball.reset_position()
40+
scoreboard.update_lives()
41+
if scoreboard.lives == 0:
42+
scoreboard.game_over()
43+
game_is_on = False
44+
45+
# Brick Collision
46+
for brick in bricks.all_bricks:
47+
if ball.distance(brick) < 35:
48+
ball.bounce_y()
49+
brick.hideturtle()
50+
bricks.all_bricks.remove(brick)
51+
scoreboard.point()
52+
53+
screen.exitonclick()

days081-090/day086/Breakout/paddle.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from turtle import Turtle
2+
3+
4+
class Paddle(Turtle):
5+
6+
def __init__(self, position):
7+
super().__init__()
8+
self.create_paddle(position)
9+
10+
def create_paddle(self, position):
11+
self.shape("square")
12+
self.penup()
13+
self.shapesize(stretch_wid=1, stretch_len=5)
14+
self.color("white")
15+
self.setpos(position)
16+
17+
def left(self):
18+
new_x = self.xcor() - 20
19+
self.goto(new_x, self.ycor())
20+
21+
def right(self):
22+
new_x = self.xcor() + 20
23+
self.goto(new_x, self.ycor())
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from turtle import Turtle
2+
3+
4+
class Scoreboard(Turtle):
5+
6+
def __init__(self):
7+
super().__init__()
8+
self.color("white")
9+
self.penup()
10+
self.hideturtle()
11+
self.score = 0
12+
self.lives = 3
13+
self.update_scoreboard()
14+
15+
def update_scoreboard(self):
16+
self.clear()
17+
self.goto(-200, 350)
18+
self.write(f"SCORE:{self.score}", align="center", font=("Courier", 30, "bold"))
19+
self.goto(180, 350)
20+
self.write(f"LIVES:{self.lives}", align="center", font=("Courier", 30, "bold"))
21+
22+
def update_lives(self):
23+
self.lives -= 1
24+
self.update_scoreboard()
25+
26+
def point(self):
27+
self.score += 1
28+
self.update_scoreboard()
29+
30+
def game_over(self):
31+
self.goto(0, 0)
32+
self.write("GAME OVER", align="center", font=("Courier", 30, "bold"))

days081-090/day086/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Day 86 - Breakout Python: The Famous Arcade Game
2+
3+
## Concepts Practised
4+
- Create a Paddle that responds to Key Presses
5+
- Write the Ball Class and Make the Ball Move
6+
- Add the Ball Bouncing Logic
7+
- How to Detect Collisions with the Paddle
8+
- How to Detect when the Ball goes Out of Bounds
9+
- Score Keeping and Changing the Ball Speed
10+
11+
## Run Locally:
12+
13+
1. CD into the ./Breakout directory
14+
15+
2. Run the following command in the terminal to play the game:
16+
17+
```bash
18+
python main.py
19+
```
20+
21+
## Breakout Demo
22+
![day86](https://user-images.githubusercontent.com/98851253/170151872-83a5efd9-aef4-4970-be00-8fe1eb89685e.gif)

days081-090/day087/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Day 87 Course Assignment: Cafe & Wifi Website:
2+
3+
## See [Day 62](../../days061-070/day062)

days081-090/day088/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Day 88 - To Do Agenda App
2+
3+
## Concepts Practised
4+
- Create a Web Server with Flask
5+
- Use the Command Line on Windows and Mac
6+
- `__name__` and `__main__` : Special Attributes built into Python
7+
- Python Decorator Functions and the `@` Syntax
8+
- Flask URL Paths and the Flask Debugger
9+
- Rendering HTML Elements with Flask
10+
- Use Python Decorators to Style HTML Tags
11+
- Decorators with `*args` and `**kwargs`
12+
Create a Python Decorator
13+
14+
## Run Locally:
15+
16+
1. CD into the project folder: `./todo-app`
17+
18+
2. Run `pip install -r requirements.txt` to install the dependencies
19+
20+
3. Run the flask app with `python main.py`
21+
22+
## To Do App Demo
23+
<img width="955" alt="day88" src="https://user-images.githubusercontent.com/98851253/170607934-975540fc-22c3-44aa-8118-7f42af2ee252.png">

days081-090/day088/todo-app/db.sqlite

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)