CSS Glassmorphism Techniques
1 exchange•
CSS Glassmorphism Techniques
1 exchange•
glassmorphism
◀
glassmorphism
◀
Enhancing Fibonacci with Web Frameworks
3 exchanges•
Enhancing Fibonacci with Web Frameworks
3 exchanges•
So we have this command line program @fibonacci.py but I want to make this way cooler.
To start, lets make it display as a simple web app. What do you suggest we use? Flask or FastAPI? Or something else, what are the best packages to display webapps with Python that are not streamlit?
◀
So we have this command line program @fibonacci.py but I want to make this way cooler. To start, lets make it display as a simple web app. What do you suggest we use? Flask or FastAPI? Or something else, what are the best packages to display webapps with Python that are not streamlit?
◀
So we have this command line program @fibonacci.py but I want to make this way cooler.
Let's use Flask to build a web app that can display this
◀
So we have this command line program @fibonacci.py but I want to make this way cooler. Let's use Flask to build a web app that can display this
◀
I always want to use poetry to install packages
◀
I always want to use poetry to install packages
◀
Creating ASCII Art Fibonacci Spiral
8 exchanges•
Creating ASCII Art Fibonacci Spiral
8 exchanges•
Cool, now i want to allow the program to build an ascii art spiral, let's use this example code to help us do that
mport time
from typing import Generator
def fibonacci_generator() -> Generator[int, None, None]:
"""Generates Fibonacci numbers infinitely."""
a, b = 0, 1
while True:
yield a
a, b = b, a + b
def create_spiral(size: int, char: str = "★") -> list[list[str]]:
"""Creates a grid for the spiral."""
return [[" " for _ in range(size)] for _ in range(size)]
def draw_line(grid: list[list[str]], x: int, y: int, length: int,
direction: str, char: str = "★") -> tuple[int, int]:
"""Draws a line in the specified direction and returns new position."""
for i in range(length):
if 0 <= x < len(grid) and 0 <= y < len(grid):
grid[y][x] = char
if direction == "right":
x += 1
elif direction == "down":
y += 1
elif direction == "left":
x -= 1
elif direction == "up":
y -= 1
return x, y
def create_fibonacci_spiral(n: int) -> None:
"""Creates and displays a growing Fibonacci spiral."""
fib_gen = fibonacci_generator()
size = 40 # Grid size
grid = create_spiral(size)
x, y = size // 2, size // 2 # Start at center
# Direction sequence for spiral
directions = ["right", "down", "left", "up"]
dir_idx = 0
# Generate and draw the spiral
for _ in range(n):
length = next(fib_gen)
if length > 0: # Skip drawing for zero
x, y = draw_line(grid, x, y, length, directions[dir_idx])
dir_idx = (dir_idx + 1) % 4
# Clear screen (works in Unix-like systems)
print("\033[H\033[J")
# Display the current state
print(f"Fibonacci Number: {length}")
print("Fibonacci Spiral:")
print("+" + "-" * (size) + "+")
for row in grid:
print("|" + "".join(row) + "|")
print("+" + "-" * (size) + "+")
time.sleep(0.5) # Pause to show growth
if __name__ == "__main__":
create_fibonacci_spiral(15) # Generate first 15 Fibonacci numbers
◀
Cool, now i want to allow the program to build an ascii art spiral, let's use this example code to help us do that mport time from typing import Generator def fibonacci_generator() -> Generator[int, None, None]: """Generates Fibonacci numbers infinitely.""" a, b = 0, 1 while True: yield a a, b = b, a + b def create_spiral(size: int, char: str = "★") -> list[list[str]]: """Creates a grid for the spiral.""" return [[" " for _ in range(size)] for _ in range(size)] def draw_line(grid: list[list[str]], x: int, y: int, length: int, direction: str, char: str = "★") -> tuple[int, int]: """Draws a line in the specified direction and returns new position.""" for i in range(length): if 0 <= x < len(grid) and 0 <= y < len(grid): grid[y][x] = char if direction == "right": x += 1 elif direction == "down": y += 1 elif direction == "left": x -= 1 elif direction == "up": y -= 1 return x, y def create_fibonacci_spiral(n: int) -> None: """Creates and displays a growing Fibonacci spiral.""" fib_gen = fibonacci_generator() size = 40 # Grid size grid = create_spiral(size) x, y = size // 2, size // 2 # Start at center # Direction sequence for spiral directions = ["right", "down", "left", "up"] dir_idx = 0 # Generate and draw the spiral for _ in range(n): length = next(fib_gen) if length > 0: # Skip drawing for zero x, y = draw_line(grid, x, y, length, directions[dir_idx]) dir_idx = (dir_idx + 1) % 4 # Clear screen (works in Unix-like systems) print("\033[H\033[J") # Display the current state print(f"Fibonacci Number: {length}") print("Fibonacci Spiral:") print("+" + "-" * (size) + "+") for row in grid: print("|" + "".join(row) + "|") print("+" + "-" * (size) + "+") time.sleep(0.5) # Pause to show growth if __name__ == "__main__": create_fibonacci_spiral(15) # Generate first 15 Fibonacci numbers
◀
What can you think of to make this even cooler?
◀
What can you think of to make this even cooler?
◀
The rainbow colors don't show, let's improve that
◀
The rainbow colors don't show, let's improve that
◀
Large numbers (e.g. 50) don't seem to generate the ascii art very quickly, how can we improve this?
◀
Large numbers (e.g. 50) don't seem to generate the ascii art very quickly, how can we improve this?
◀
Lets add a git repo to this project and gitignore file
◀
Lets add a git repo to this project and gitignore file
◀
Let's handle the return display of large numbers better in the interface. How could we make that more comprehensible?
◀
Let's handle the return display of large numbers better in the interface. How could we make that more comprehensible?
◀
What is this input box supposed to do?
◀
What is this input box supposed to do?
◀
Make those a dropdown
◀
Make those a dropdown
◀
Fixing Grid Logic for Character Choices
15 exchanges•
Fixing Grid Logic for Character Choices
15 exchanges•
Different choices than star tends to break our grid
Let's fix the logic that computes this so no matter spiral chracater is chosen the grid looks good and the spacing doesn't break
◀
Different choices than star tends to break our grid Let's fix the logic that computes this so no matter spiral chracater is chosen the grid looks good and the spacing doesn't break
◀
That didn't work, lets make sure we're thorough in checking our logic and that this behaves like it did previously to ensure that the spiral character results in a very nice grid regardless of what is chosen
◀
That didn't work, lets make sure we're thorough in checking our logic and that this behaves like it did previously to ensure that the spiral character results in a very nice grid regardless of what is chosen
◀
The spiral implementation is messed up now. Lets re-evaluate our algorithm and make it work
◀
The spiral implementation is messed up now. Lets re-evaluate our algorithm and make it work
◀
How is the spiral algorithm supposed to work with very large terms?
◀
How is the spiral algorithm supposed to work with very large terms?
◀
Let's make our spiral algorithm much bettrer. I want the spiral to grow large and be in charge. I want our algo to be rock solid, so solid it surprises itself.
◀
Let's make our spiral algorithm much bettrer. I want the spiral to grow large and be in charge. I want our algo to be rock solid, so solid it surprises itself.
◀
Explain what the spiral actually represents? It doesn't seem to match with my terms
◀
Explain what the spiral actually represents? It doesn't seem to match with my terms
◀
OK this is good generally BUT we need to make it determistic it feels stochastic. For example, 5 is displaying 6 characters.
◀
OK this is good generally BUT we need to make it determistic it feels stochastic. For example, 5 is displaying 6 characters.
◀
I don't think our grid is large enough to display the full beauty of our spiral
◀
I don't think our grid is large enough to display the full beauty of our spiral
◀
Are there template updates you need to make?
◀
Are there template updates you need to make?
◀
Lets adjust the size of the gird dynamically depending on what type of spiral is generated to make it trim so that its easier to see the spiral without as much scrolling
◀
Lets adjust the size of the gird dynamically depending on what type of spiral is generated to make it trim so that its easier to see the spiral without as much scrolling
◀
Lets make the input interface much cleaner, smaller input boxes, better buttons, etc
◀
Lets make the input interface much cleaner, smaller input boxes, better buttons, etc
◀
Good but lets enhance it further so it looks super profresh
◀
Good but lets enhance it further so it looks super profresh
◀
Some of the styling could be even more profesh. but i like where we're going
◀
Some of the styling could be even more profesh. but i like where we're going
◀
Big terms like 50 tend to hang my app. Is there any further performance optimizations you can do just on the algorithm generation because I want to preserve all the functionality of my app right now
◀
Big terms like 50 tend to hang my app. Is there any further performance optimizations you can do just on the algorithm generation because I want to preserve all the functionality of my app right now
◀
Update our @README.md to reflect all of the changes we've made that are all stored in @history
◀
Update our @README.md to reflect all of the changes we've made that are all stored in @history
◀