Parabel
This commit is contained in:
parent
9b2fe07fca
commit
bdcca10d76
1 changed files with 61 additions and 0 deletions
61
parabeltest.py
Executable file
61
parabeltest.py
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
import os, sys, termios, tty, time, random
|
||||||
|
from math import sin, cos, sqrt
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
# Randomly choose a cow
|
||||||
|
cows = "🐵🐒🦍🦧🐕🐯🦝🐩🐅🐴🐎🦄🦌🐗🐂🐃🐄🐪🐫🦙🦒🐹🦘🦡🐧🕊️🦅🦆🦉🐍🦎🐊🦜🦚🦩🐲🐉🦕"
|
||||||
|
cowslength = len(cows)
|
||||||
|
# cow = cows[random.randint(0, cowslength - 1)]
|
||||||
|
# cow = "🐄"
|
||||||
|
cow = "*"
|
||||||
|
|
||||||
|
# Needed: find our screensize
|
||||||
|
termsize_xy = os.get_terminal_size()
|
||||||
|
xmax = termsize_xy[0] - 1
|
||||||
|
xmitte = xmax / 2
|
||||||
|
ymax = termsize_xy[1]
|
||||||
|
|
||||||
|
# CTRL and ESC-codes for the used outputdevice. Probably a terminal.
|
||||||
|
clear, home, curoff, curon = "'\x1b[2J\x1b[H", "\x1b[H", "\x1b[?25l", "\x1b[?25h"
|
||||||
|
|
||||||
|
|
||||||
|
# pi is not defined by default
|
||||||
|
pi = 3.1416
|
||||||
|
deg2rad = pi / 180
|
||||||
|
# position cursor at x,y - where x=0 y=0 is the left lower corner like in mathematical diagrams
|
||||||
|
def curpos(x, y):
|
||||||
|
print("\033[%d;%dH" % (ymax - y, x), end="", flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
# some scales, we need
|
||||||
|
# not everything has to be recomputed in loops.
|
||||||
|
angle = 80 * deg2rad
|
||||||
|
sinangle = sin(angle)
|
||||||
|
cosangle = cos(angle)
|
||||||
|
power = sin(50 * deg2rad)
|
||||||
|
xsteps = xmax
|
||||||
|
gravitation = 10
|
||||||
|
x = 0
|
||||||
|
y = x**2
|
||||||
|
|
||||||
|
# init screen and wait for userinput
|
||||||
|
print(clear, curoff)
|
||||||
|
print(xsteps)
|
||||||
|
a = input("CR please:")
|
||||||
|
|
||||||
|
curpos(1, ymax)
|
||||||
|
for x in range(1, xsteps):
|
||||||
|
# parameters to fit the screen
|
||||||
|
y = (x - xmitte) ** 2 /xmitte
|
||||||
|
if y < ymax:
|
||||||
|
curpos(x, ymax- y)
|
||||||
|
print(cow, end="")
|
||||||
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
|
||||||
|
curpos(1, 1)
|
||||||
|
sys.exit(curon + "Schulz nun.")
|
Loading…
Reference in a new issue