ChatGPT
I've been very impressed with ChatGPT by OpenAI. It is capable of a very wide range of tasks. I highly recommend everyone go check out ChatGPT if you haven't. I am confident you'll be able to find some way to use it to improve your life.
Below is a list of some of the tasks it is capable of:
- Write John Conway's Game of Life in PROCESSING/Java
- Improve the Chinese in my article on using Genetic Algorithms to generate images. This use-case was particularly useful and surprising to me. Here is a side-by-side comparison in Google Docs: https://lnkd.in/g-_sj4T2
- Generate a Chinese language lesson on the subject of "Microscopes and Microorganisms" including vocabulary, example sentences, and dialogues. I'm expanding this to cover even more niche subjects that I think will be helpful to Chinese learners.
- Write short stories on an array of subjects. Check ^ GitHub README for links to the stories "Hell" and "Transcension".
- Write a Mandelbrot Zoom in Python/Pygame
- Write a program to control a DC motor using the L298N Motor Driver Controller with reverse and forward. I've been working on some robotics projects, and this one surprised me given how niche it is.
- Write a simple BlackJack game in Pygame, to help out my friend Steven Halla who is learning game dev with Pygame.
- Write a simple neural network + autocoder in Python.
- Write Python code to read camera data via picamera2 and detect faces with OpenCV.
- Write a program to generate an infinite psychedelic pattern.
🤖️ Input: "Using the programming language PROCESSING (java mode), write john conway's game of life and then simplify the code and remove code comments"
Source: game_of_life.py
Worked after minor edits and asking ChatGPT to write specific functions separately due to the length of the program. This surprisingly worked quite well, and I only needed reference ChatGPT in order to write this program. Additionally, this is my first project to use Processing. (I have since learned you can just tell ChatGPT to "Continue on".)
🤖️ Input: "Using python programming language write a mandelbrot zoom program in pygame"
Source: mandelbrot_zoom.py
I was again happily surprised that the code both compiled and ran. The only issue I encountered was that the Mandelbrot Zoom was being re-rendered every game loop instead of only when there were changes to its zoom & position. This was an easy update, and below are some example GIFs that I compiled from some output screenshots. I'm pretty confident that I could have just asked ChatGPT to make such improvements, and even handle the image output, but I was hitting rate-limit issues with the API.
🤖️ Input: "Using the programming language PROCESSING, write a program to draw a psychedelic fractal zoom"
Source: pyschedelic_fractal.pde
Output:
Here is a simple implementation of a psychedelic fractal zoom in the programming language Processing: This code generates a psychedelic fractal zoom by drawing a series of lines with random colors at each iteration. The zoom level is gradually increased over time, resulting in a constantly changing and mesmerizing visual effect.
Worked after moving size(500, 500);
into the setup()
function.
🤖️ Input: "Write python code to control dc motor with L298N Motor Driver Controller with reverse and forward"
Source: dc_motor_with_l298n.py
I was quite surprised as to the breadth of ChatGPT with this one. It was able to generate a working Python code to control two DC motors via the L298N Motor Driver Controller with reverse and forward. The generated code had a minor bug that prevented reverse from working, otherwise it worked out-of-the-box. I tested it on a robotic tank I have been working on.
🤖️ Input: "Write a simple neural network in python and then remove code comments"
Source: neural_network.py
Code worked as-is.
Target Vector: [0, 1, 1, 0]
Output:
[[0.03896381]
[0.95923365]
[0.96770453]
[0.04000064]]
🤖️ Input: "Write code using tensorflow for a simple auto-encoder with training data random 4d vectors"
Source: autocoder.py
Code worked as-is, though I modified logging + epoch count.
Output:
Original input: [[0.27955452 0.20003414 0.38206231 0.71578143]]
Decoded output: [[0.21143627 0.1500811 0.30098823 0.6853668 ]]
Noisy input: [[0.36291848 0.20566826 0.39934306 0.81038985]]
Decoded Noise output: [[0.28726333 0.15678793 0.31848305 0.7758708 ]]
🤖️ Input: "Using the python programming language that please write a program for visually pleasing infinite psychedelic pattern."
I was indeed pleased with the result!
Source: visually_pleasing_infinite_pattern.py
🤖️ Input: "Write python code to read camera data via picamera2 and detect faces with opencv."
Source: opencv_face_detection.py
🤖️ Input: "Write python code for blackjack game"
File: blackjack.py
I finished the final lines of code myself due to ChatGPT output buffer max length.
Your hand:
10 of Hearts
3 of Spades
Dealer's hand:
10 of Diamonds
Your hand:
10 of Hearts
3 of Spades
10 of Clubs
You busted! Dealer wins.
Your hand:
5 of Spades
1 of Diamonds
Dealer's hand:
10 of Clubs
Your hand:
5 of Spades
1 of Diamonds
2 of Spades
Your hand:
5 of Spades
1 of Diamonds
2 of Spades
1 of Hearts
Your hand:
5 of Spades
1 of Diamonds
2 of Spades
1 of Hearts
10 of Clubs
You win!
Source: blackjack2.py
Worked as-is
Your hand:
7 of Hearts
10 of Clubs
Dealer's hand:
2 of Clubs
Dealer's hand:
2 of Clubs
7 of Spades
10 of Hearts
You Lose!
🤖️ Input: "Using the Python programming language write code to generate pokemon like techno music"
While not particularly Pokémon like, I was surprised this program worked. I only needed to download a few WAV files.
Source: pokemon_like_techno.py
🤖️ Input: "Using the python programming language and pygame library and only geometry shapes, write a simple bomberman game**"
The generated code had a couple issues such as bomberman_x
and bomberman_y
being undefined, and the player + background colors were the same.
I was still impressed that I was able to get nearly working PyGame
starter program with working Joystick controls.
Source: bomberman.py
🤖️ Input: "Using the programming language PROCESSING (java mode), write a program to draw a psychedelic pattern"
Source: pyschedelic_pattern.pde
Worked after minor editing.
🤖️ Improve Chinese Blog Post - 遗传算法与重现画像
This was a blog post I wrote in Chinese previously on the subject of generating images using genetic algorithms. Linked below is a Google Doc which shows the before and after for each paragraph. I was quite impressed with the results and ChatGPT was even able to explain it's reasoning for its changes.
🤖️ Chinese Lesson - 显微镜与微生物 / Microscopes & Microorganisms
Lesson: chinese_lesson_microscopes_microorganisms.md
This project/experiment was motivated by the success I had using ChatGPT to improve my Chinese post on genetic algorithms.
🤖️ Short Stories
Hell - "Write short story about reality hell and god that will give me an existential crisis"
Transcension - "Write a short story about transcension and the full realization of absolute infinity"