idk__.py

Created by chick-chicky

Created on February 10, 2023

8.47 KB


from math import *
from kandinsky import *
from ion import *
from time import monotonic,sleep
sw,sh=15,15  # street dimensions
cw,ch=13,13  # cell dimensions
ct=[         # cell types
  [cw,ch]+[2]*(cw*ch),
  [10,10,
   1,1,1,1,1,1,1,1,1,1,
   1,0,0,0,0,0,0,0,0,0,
   1,0,0,0,0,0,0,0,0,1,
   1,0,0,0,0,0,0,0,0,0,
   1,0,0,0,0,0,0,0,0,1,
   1,0,0,0,0,0,0,0,0,0,
   1,0,0,0,0,0,0,0,0,1,
   1,0,0,0,0,0,0,0,0,0,
   1,0,0,0,0,0,0,0,0,1,
   1,0,1,0,1,0,1,0,1,0
  ],
  [13,13,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,1,1,1,1,1,0,0,0,0,
   0,0,0,1,0,0,0,0,0,1,0,0,0,
   0,0,0,1,0,1,1,1,0,1,0,0,0,
   0,0,0,1,0,1,1,1,0,1,0,0,0,
   0,0,0,1,1,1,1,1,1,1,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
  ],
  [13,13,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,0,0,1,1,1,1,1,0,0,0,0,
   0,0,0,1,0,0,0,0,0,1,0,0,0,
   0,0,1,0,0,0,0,0,0,0,1,0,0,
   0,0,1,0,1,1,0,1,1,0,1,0,0,
   0,0,1,0,0,0,0,0,0,0,1,0,0,
   0,0,1,0,0,1,1,1,0,0,1,0,0,
   0,0,1,0,0,1,1,1,0,0,1,0,0,
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0,0,0,
   0,0,0,0,1,0,1,0,1,0,0,0,0,
   0,0,0,0,1,0,0,0,1,0,0,0,0,
   1,1,1,1,1,0,1,0,1,1,1,1,1,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   1,0,1,0,1,0,1,0,1,0,1,0,1,
   0,0,0,0,0,0,0,0,0,0,0,0,0,
   1,1,1,1,1,0,1,0,1,1,1,1,1,
   0,0,0,0,1,0,0,0,1,0,0,0,0,
   0,0,0,0,1,0,1,0,1,0,0,0,0,
   0,0,0,0,1,0,0,0,1,0,0,0,0,
   0,0,0,0,1,0,1,0,1,0,0,0,0,
  ],
]
cl=[(255,255,255),(0,0,0),None] # colors
c=[1]*(sw*sh)  # cells
for i in range(len(ct)):
 c[i] = i
def rt(t,x,y): # render tile
  c=ct[t]
  for px in range(c[0]):
    for py in range(c[1]):
      pv=cl[c[2+px+(c[1]-py-1)*c[0]]]
      if pv:set_pixel(px+x,-py+y,pv)
def ds(): # draw screen
  for px in range(sw):
    for py in range(sh):
      rt(c[px+py*sw],px*cw,(py+2)*ch)
s = monotonic()
ds()
draw_string(str(monotonic()-s),0,50)
while not keydown(KEY_OK): 
  sleep(0.1)
  set_pixel(0,0,(255,0,0))

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.