Compare commits
No commits in common. "ae3a0c45db3848f155c39bdc642508c46511fc60" and "8f7a96ccaf2abed263f6d9751ee87495a910617e" have entirely different histories.
ae3a0c45db
...
8f7a96ccaf
4 changed files with 0 additions and 318 deletions
92
bonk.py
92
bonk.py
|
@ -1,92 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Ein hilfloser Versuch, Tasteneingaben abzufragen. Man kann auch in Python C schreiben. Ein Thread wär evtl besser. """
|
||||
|
||||
import os, sys, termios, tty, time
|
||||
|
||||
esc = chr(27)
|
||||
bracket = chr(91)
|
||||
c_up = chr(65)
|
||||
c_down = chr(66)
|
||||
c_right = chr(67)
|
||||
c_left = chr(68)
|
||||
x, xold, y, yold = 15, 15, 15, 15
|
||||
clear = "'\x1b[2J\x1b[H"
|
||||
|
||||
car = "🚜"
|
||||
replstring = " "
|
||||
termsize_xy = os.get_terminal_size()
|
||||
frame = 0
|
||||
xmax = termsize_xy[0] - frame
|
||||
ymax = termsize_xy[1] - frame
|
||||
ymin = 1 + frame
|
||||
xmin = 1 + frame
|
||||
street = "# #"
|
||||
streetwidth=len(street)
|
||||
streetymax=ymax-streetwidth
|
||||
|
||||
def curpos(x, y):
|
||||
print("\033[%d;%dH" % (y, x), end="", flush=True)
|
||||
|
||||
|
||||
def cursoroff():
|
||||
sys.stdout.write("\033[?25l")
|
||||
|
||||
|
||||
def cursoron():
|
||||
sys.stdout.write("\033[?25h")
|
||||
|
||||
|
||||
def getkey():
|
||||
getkey_buffer = 1
|
||||
fd = sys.stdin.fileno()
|
||||
remember_attributes = termios.tcgetattr(fd)
|
||||
tty.setraw(sys.stdin.fileno())
|
||||
taste = sys.stdin.read(getkey_buffer)
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, remember_attributes)
|
||||
return taste
|
||||
|
||||
def zeichnestrasse():
|
||||
xstreet=xstreet+(int(random(ymin, (ymax-
|
||||
print(street)
|
||||
|
||||
|
||||
print(clear)
|
||||
cursoroff()
|
||||
taste = ""
|
||||
while taste != "q":
|
||||
# taste = ""
|
||||
# while taste == "":
|
||||
taste = getkey()
|
||||
|
||||
if taste == esc:
|
||||
taste = getkey()
|
||||
if taste == bracket:
|
||||
taste = getkey()
|
||||
|
||||
yold = y
|
||||
xold = x
|
||||
if taste == c_right:
|
||||
if x < xmax and y < ymax:
|
||||
x += 1
|
||||
elif taste == c_left:
|
||||
if x > xmin:
|
||||
x -= 1
|
||||
|
||||
curpos(xold, yold)
|
||||
print(replstring, end="")
|
||||
|
||||
curpos(x, y)
|
||||
print(car, end="")
|
||||
|
||||
curpos(1, 1)
|
||||
print("x = ", x, " \ny = ", y, " ")
|
||||
curpos(1, 3)
|
||||
print("xold = ", xold, " \nyold = ", yold, " ")
|
||||
curpos(ymax, 10)
|
||||
print (street)
|
||||
|
||||
|
||||
cursoron()
|
||||
sys.exit("Schulz nun.")
|
|
@ -1,80 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Ein hilfloser Versuch, Tasteneingaben abzufragen. Man kann auch in Python C schreiben. Ein Thread wär evtl besser. """
|
||||
|
||||
import os, sys, termios, tty, time
|
||||
|
||||
esc = chr(27)
|
||||
bracket = chr(91)
|
||||
c_up = chr(65)
|
||||
c_down = chr(66)
|
||||
c_right = chr(67)
|
||||
c_left = chr(68)
|
||||
x, xold, y, yold = 15, 15, 15, 15
|
||||
clear = "'\x1b[2J\x1b[H"
|
||||
|
||||
replstring = " "
|
||||
|
||||
|
||||
def curpos(x, y):
|
||||
print("\033[%d;%dH" % (y, x), end="", flush=True)
|
||||
|
||||
|
||||
def cursoroff():
|
||||
sys.stdout.write("\033[?25l")
|
||||
|
||||
|
||||
def cursoron():
|
||||
sys.stdout.write("\033[?25h")
|
||||
|
||||
|
||||
termsize_xy = os.get_terminal_size()
|
||||
frame = 0
|
||||
xmax = termsize_xy[0] - frame
|
||||
ymax = termsize_xy[1] - frame
|
||||
ymin = 1 + frame
|
||||
xmin = 1 + frame
|
||||
street = "# #"
|
||||
pi=3.1416
|
||||
deg2rad=pi/180
|
||||
|
||||
|
||||
print(clear)
|
||||
cursoroff()
|
||||
taste = ""
|
||||
while taste != "q":
|
||||
# taste = ""
|
||||
# while taste == "":
|
||||
taste = getkey()
|
||||
|
||||
if taste == esc:
|
||||
taste = getkey()
|
||||
if taste == bracket:
|
||||
taste = getkey()
|
||||
|
||||
yold = y
|
||||
xold = x
|
||||
if taste == c_right:
|
||||
if x < xmax and y < ymax:
|
||||
x += 1
|
||||
elif taste == c_left:
|
||||
if x > xmin:
|
||||
x -= 1
|
||||
|
||||
curpos(xold, yold)
|
||||
print(replstring, end="")
|
||||
|
||||
curpos(x, y)
|
||||
print(car, end="")
|
||||
|
||||
curpos(1, 1)
|
||||
print("x = ", x, " \ny = ", y, " ")
|
||||
curpos(1, 3)
|
||||
print("xold = ", xold, " \nyold = ", yold, " ")
|
||||
curpos(ymax, 10)
|
||||
print (street)
|
||||
|
||||
|
||||
cursoron()
|
||||
sys.exit("Schulz nun.")
|
100
scrollup.py
100
scrollup.py
|
@ -1,100 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Ein hilfloser Versuch, Tasteneingaben abzufragen. Man kann auch in Python C schreiben. Ein Thread wär evtl besser. """
|
||||
|
||||
import os, sys, termios, tty, time, random
|
||||
from math import sin, cos
|
||||
|
||||
esc = chr(27)
|
||||
bracket = chr(91)
|
||||
c_up = chr(65)
|
||||
c_down = chr(66)
|
||||
c_right = chr(67)
|
||||
c_left = chr(68)
|
||||
clear = "'\x1b[2J\x1b[H"
|
||||
car = "🚜"
|
||||
replstring = " "
|
||||
fd = sys.stdin.fileno()
|
||||
remember_attributes = termios.tcgetattr(fd)
|
||||
|
||||
|
||||
termsize_xy = os.get_terminal_size()
|
||||
xmax = termsize_xy[0] - 1
|
||||
ymax = termsize_xy[1]
|
||||
x, xold, y, yold = xmax / 2, xmax / 2, ymax - 1, ymax - 1
|
||||
ymin = 1
|
||||
xmin = 1
|
||||
street = "# #"
|
||||
streetlen = len(street)
|
||||
pi = 3.1416
|
||||
deg2rad = pi / 180
|
||||
curvelen = 40
|
||||
toggle = 1
|
||||
curvemax = random.randint(len(street) + 1, xmax - len(street))
|
||||
taste = ""
|
||||
z = 90
|
||||
|
||||
x = int((sin(curvelen * deg2rad) * cos(xmax - curvelen * deg2rad) + 1) * (xmax / 2))
|
||||
|
||||
|
||||
def curpos(x, y):
|
||||
print("\033[%d;%dH" % (y, x), end="", flush=True)
|
||||
|
||||
|
||||
def cursoroff():
|
||||
sys.stdout.write("\033[?25l")
|
||||
|
||||
|
||||
def cursoron():
|
||||
sys.stdout.write("\033[?25h")
|
||||
|
||||
|
||||
def getkey():
|
||||
getkey_buffer = 1
|
||||
tty.setraw(sys.stdin.fileno())
|
||||
taste = sys.stdin.read(getkey_buffer)
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, remember_attributes)
|
||||
return taste
|
||||
|
||||
|
||||
print(clear)
|
||||
cursoroff()
|
||||
|
||||
while taste != "x" and taste != "q":
|
||||
taste = getkey()
|
||||
|
||||
if taste == esc:
|
||||
taste = getkey()
|
||||
########## Print car
|
||||
if taste == bracket:
|
||||
taste = getkey()
|
||||
yold = y
|
||||
xold = x
|
||||
if taste == c_right:
|
||||
if x < xmax and y < ymax:
|
||||
x += 1
|
||||
elif taste == c_left:
|
||||
if x >= xmin:
|
||||
x -= 1
|
||||
curpos(x, y)
|
||||
print(car, end="")
|
||||
curpos(xold, yold - 1)
|
||||
print(replstring, end="")
|
||||
|
||||
####### print street
|
||||
curvelen = int(curvelen + toggle) % 360
|
||||
|
||||
if curvelen <= 40 or curvelen == curvemax:
|
||||
curvemax = random.randint(len(street) * 3, 180)
|
||||
z += toggle
|
||||
toggle *= -1
|
||||
curvelen = int(curvelen + toggle) % 360
|
||||
streetpos = int((sin(curvelen * deg2rad) * cos(xmax - curvelen * deg2rad) + 1) * (xmax / 2))
|
||||
curvelen += toggle % 360
|
||||
curpos(streetpos, ymax)
|
||||
print(street)
|
||||
|
||||
|
||||
cursoron()
|
||||
sys.exit("Schulz nun.")
|
46
sintest.py
46
sintest.py
|
@ -1,46 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import os, sys, termios, tty, time, random
|
||||
from math import sin, cos, sqrt
|
||||
from time import sleep
|
||||
|
||||
|
||||
termsize_xy = os.get_terminal_size()
|
||||
xmax = termsize_xy[0] - 1
|
||||
ymax = termsize_xy[1]
|
||||
|
||||
tree = "🌳"
|
||||
frequency = int(xmax / 5)
|
||||
street = tree
|
||||
for i in range(0, frequency):
|
||||
street += " "
|
||||
street += tree
|
||||
streetwidth = len(street)
|
||||
amplitude = (xmax - streetwidth*4) / 3
|
||||
streetpos = amplitude
|
||||
pi = 3.1416
|
||||
deg2rad = pi / 180
|
||||
toggle = 1
|
||||
maxpos = xmax - streetwidth
|
||||
maxamp = xmax - streetwidth / 3
|
||||
|
||||
|
||||
def curpos(x, y):
|
||||
print("\033[%d;%dH" % (y, x), end="", flush=True)
|
||||
|
||||
|
||||
while True:
|
||||
sleep(0.01)
|
||||
amplitude += toggle
|
||||
frequency = frequency + toggle
|
||||
streetpos = int(sin(frequency * deg2rad) * cos(frequency * deg2rad + 1) * amplitude + streetwidth*4)
|
||||
frequency += toggle
|
||||
curpos(streetpos, ymax)
|
||||
print(street)
|
||||
if amplitude >= maxamp or amplitude < 3:
|
||||
toggle *= -1
|
||||
|
||||
|
||||
sys.exit("Schulz nun.")
|
Loading…
Reference in a new issue