Compare commits

...

2 commits

Author SHA1 Message Date
2c18e417fb engine erweitern 2023-11-15 12:29:04 +01:00
6af5e8afc9 engine erweitern 2023-11-06 20:13:12 +01:00
4 changed files with 47 additions and 31 deletions

View file

Binary file not shown.

View file

@ -1,22 +1,42 @@
from os import get_terminal_size
class tengine():
tx, ty = get_terminal_size().columns, get_terminal_size().lines
#feld = [[""]*10]*10
feld = [["","","",],["","","",],["","","",]]
tx = get_terminal_size().columns
ty = get_terminal_size().lines
def genfeld():
feld = [[' ' for _ in range(tx)] for _ in range(ty)]
return feld
def bg_char(feld,char=str):
test = 0
for a in range(len(feld)):
for b in range(len(feld[0])):
feld[a][b] = test
test = char
return feld
def strfeld(feld):
back = ""
for a in feld:
for b in a:
print(test)
b = test
test +=1
print(feld)
def strfeld():
back = ""
for a in tengine.feld:
for b in a:
back += b
back += "\n"
return back
def addchar(character=str,position=list):
tengine.feld[2][2] = "a"
back += str(b)
back += "\n"
return back
def change_char(feld,character=str,position=list):
feld[position[0]][position[1]] = character
def change_block(feld,string=str,position=list):
a = ""
block_len = 0
for a in string:
if a == "\n":
break
else:
block_len += 1
print(block_len)
for zeichen in string:
feld[position[0]][position[1]] = zeichen
position[0] += 1
if position[0]== block_len-1:
position[0] = 0
return feld

View file

@ -1,15 +1,11 @@
#from tengine import tengine
#tengine.addchar("a",[5,5])
#print(tengine.feld)
import tengine
feld = tengine.genfeld()
feld = [["","","",],["","","",],["","","",]]
feld[1][1] = "a"
test = 0
for a in feld:
for b in a:
print(test)
b = test
print(b)
test +=1
feld[1][1] = "a"
print(feld)
block = "halli\nhallo\nfurz"
block2 = """halli
hallo
furz"""
feld = tengine.bg_char(feld,"#")
feld = tengine.change_block(feld,block2,[3,3])
print(tengine.strfeld(feld))