idk_.py

Created by chick-chicky

Created on February 08, 2023

737 Bytes


from math import *
from kandinsky import *
from ion import *
from time import monotonic
w,h=100,100 # view dimensions
sw,sh=10,10  # street dimensions
cw,ch=10,10  # cell dimensions
ct=[  # cell types
  [0,0]
]
cl=[None,(0,0,0),(1,1,1)] # colors
c=[0]*(sw*sh) # cells
bb=[None]*(w*h) # back buffer
def rt(t,b,x,y): # render tile
    c=ct[t]
    for px in range(c[0]):
        for py in range(c[1],0,-1):
            pv = c[px+py*c[0]]
            if pv!=None: b[px+x+(py+y+ch)*w] = pv
def ds(): # draw screen
    b=[None]*(w*h)
    for px in range(sw):
        for py in range(sh):
            rt(c[px+py*sw],b,px*cw,(py+1)*ch)
    b=bb
s = monotonic()
ds()
draw_string(str(monotonic()-s),0,0)
while not keydown(KEY_OK): pass

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.