Those are some unicode animations, donut2.c is for Windows and donut.c is for Linux, they are not the same (and not completely my work)
When compiling the c files use the -lm
flag
The cpp file is for Windows, after compiling (g++ doublePendulum.cpp -o main
) use it like so:
rem To simply see one double pendulum
main
rem To see n double pendulums
main n
The python file is compatible with python3 and python2 but you have to maximize to terminal when running it.
If you get _curses.error: addwstr() returned ERR
try decreasing the font size.
To create the badapple.txt for player.py I used this script:
try: from PIL.Image import open
except: from Image import open
from sys import stdout
from cv2 import VideoCapture, imwrite, resize
th = 127
def I2T(File):
im = open(File)
(w, h) = im.size
mim = im.convert("1")
data = list(mim.getdata())
counter = 0
field = True
for pixel in data:
if field:
if pixel > th: stdout.write("*")
else: stdout.write(" ")
counter = counter + 1
if counter >= w:
counter = 0
if field: stdout.write("\n")
field = not field
vidcap = VideoCapture('./video.mp4') # This is the video shown
success, image = vidcap.read()
while success:
imwrite(".jpg", resize(image, (144, 108), interpolation = 3))
I2T(".jpg")
success, image = vidcap.read()
print("R")
(You need to pip3 install opencv-python Pillow
in order to do that)
(on Linux you may need to run sudo apt-get install ffmpeg libsm6 libxext6 -y
to use opencv
)
I used this script like so:
python3 main.py > badapple.txt