quick
from math import * from random import choice from random import randint as Rint from kandinsky import * from kandinsky import fill_rect as FILL, from kandinsky import draw_string as STR from ion import * from time import * red=(255,0,0) green=(0,255,0) blue=(0,0,255) yellow=(255,255,0) magenta=(255,0,255) cyan=(0,255,255) black=(0,0,0) white=(255,)*3 grey=(155,)*3 light_grey=(210,)*3 light_yellow=(255, 255, 149) MX=0 MY=0 SW=322 SH=222 bg= (121, 234, 185) font_c= (50, 8, 144) MX,MY = 42,12 x,y = MX+5,MY+163 MX,MY= 36, 12 A,B=4,5 C=sqrt((int(A)**2)+(int(B)**2)) CH=chr(Rint(33,126)) CH_x=Rint(400,600) CH_y=Rint(20,160) x,y= 15, 118 """ x=MX+10 y=MY+200 """ w=13 h=19 c= (245, 176, 130) score=0 energy=35 rx=MX+Rint(400,1000) ry=MY+Rint(10,100) rw=Rint(100,500) rh=Rint(20,150) rc=(Rint(0,255),Rint(0,255),Rint(0,255)) bx=Rint(500,800) by=Rint(80,130) bw=Rint(20,100) bh=Rint(20,100) bc=(Rint(0,255),Rint(0,255),Rint(0,255)) bc_2=(Rint(0,255),Rint(0,255),Rint(0,255)) bs=Rint(4,8) num=1 den=1 n1=num n2=den n3=1 fraction=num/den product=n1*n2 sum=n1+n2 diff=n1-n2 speed=8 FILL(0,0,SW,SH,bg) def draw_room(): my_shapes= [ [0,146,6,76,(107,19,77)],[8,179,121,33,(1,82,144)],[130,176,4,46,(215,31,171)],[216,104,4,118,(27,44,84)],[204,88,28,41,(147,158,27)],[204,218,28,4,(147,158,27)], [8,170,16,9,(204,220,243)],[208,130,2,9,(8,220,243)],[218,156,2,9,(8,220,243)],[258,177,64,45,(170,103,22)],[261,183,57,13,(134,74,15)],[261,203,57,13,(134,74,15)], [263,144,50,29,(5,54,58)],[267,148,41,23,(41,93,88)],[278,186,20,2,(87,130,107)],[278,206,20,2,(87,130,107)],[158,169,44,4,(87,130,107)],[176,173,8,49,(159,133,30)], [174,166,23,2,(255,255,255)],[166,220,30,2,(99,195,105)],[164,162,7,7,(0,195,105)],[130,70,50,75,(21,7,3)],[134,74,46,70,(33,117,250)], [184,173,2,49,(0,0,0)],[232,89,2,40,(0,0,0)],[240,201,15,21,(44,69,127)] ] for p in my_shapes: FILL(*p) def draw_frac(): FILL(x+20,y,n1*2,n2*2,(Rint(0,255),Rint(0,255),Rint(0,255))) e11=1 e12=2 e13=3 e21=4 e22=5 e23=6 e31=7 e32=8 e33=9 MAT_1=[ [e11,e12,e13], [e21,e22,e23], [e31,e32,e33] ] while not keydown(KEY_EXE): n1=num n2=den product=n1*n2 sum=n1+n2 diff=n1-n2 if den>0 and num>0: fraction=num/den STR(str(num)+" / "+str(den)+" = "+str(fraction),MX+40,MY+40) STR(str(n1)+" * "+str(n2)+" = "+str(product),MX+40,MY+70) STR(str(n1)+" + "+str(n2)+" = "+str(sum),MX+40,MY+100) STR(str(n1)+" - "+str(n2)+" = "+str(diff),MX+40,MY+130) STR(str(n1)+" ^ "+str(n2)+" = "+str(n1**n2),MX+40,MY+180) if den>0 and num>0: STR(str(n1)+" ^ "+str(1)+"/"+str(n2)+" = "+str(n1**(1/n2)),MX+40,MY+240) if n1>0 and n2>0: A=n1 B=n2 C=sqrt((int(A)**2)+(int(B)**2)) STR("A = "+str(A),MX+40,MY+280) STR("B = "+str(B),MX+40,MY+310) STR("C = "+str(C),MX+40,MY+340) STR("sin("+str(int(n1))+")="+str(sin(n1)),MX+40,MY+380) STR("cos("+str(int(n1))+")="+str(cos(n1)),MX+40,MY+410) STR("tan("+str(int(n1))+")="+str(tan(n1)),MX+40,MY+440) if n1>=1: STR(str(n1)+" ^-1 (Inverse) = "+str(n1**-1),MX+40,MY+480) if n1>=1: STR("log("+str(n1)+") = "+str(log(n1)),MX+40,MY+520) STR("log10("+str(n1)+") = "+str(log10(n1)),MX+40,MY+560) STR("Binary of "+str(n1)+" = "+str(bin(n1)),MX+40,MY+600) STR("Hexadecimal of "+str(n1)+" = "+str(hex(n1)),MX+40,MY+640) if n1>0: STR("Character of chr("+str(n1)+") = "+str(chr(n1)),MX+40,MY+680) FILL(x,y,w,h,c) FILL(x,y,1,h,black) FILL(x+w-1,y,1,h,black) FILL(x,y,w,1,black) FILL(x,y+h-1,w,1,black) FILL(x+3,y+3,2,3,black) FILL(x+8,y+3,2,3,black) FILL(MX+rx,MY+ry,rw,rh,rc) if keydown(KEY_LEFT): x-=speed FILL(x+w,y,speed,h,bg) if keydown(KEY_RIGHT): x+=speed FILL(x-speed,y,speed,h,bg) if keydown(KEY_UP): sleep(0.002) y-=speed FILL(x,y+h,w,speed,bg) if keydown(KEY_DOWN): y+=speed FILL(x,y-speed,w,speed,bg) if x<1: x=1 FILL(0,0,SW,SH,bg) MX+=speed if x+w>322: x=322-w FILL(0,0,SW,SH,bg) MX-=speed if y<1: y=1 FILL(0,0,SW,SH,bg) MY+=speed if y+h>222: y=222-h FILL(0,0,SW,SH,bg) MY-=speed if keydown(KEY_MULTIPLICATION): sleep(0.2) FILL(0,0,SW,SH,bg) den-=1 # if den<1: # den=1 if keydown(KEY_DIVISION): sleep(0.2) FILL(0,0,SW,SH,bg) den+=1 if keydown(KEY_LEFTPARENTHESIS): sleep(0.2) FILL(0,0,SW,SH,bg) num-=1 if keydown(KEY_RIGHTPARENTHESIS): sleep(0.2) FILL(0,0,SW,SH,bg) num+=1 if keydown(KEY_TOOLBOX): sleep(0.2) num=n1=0 FILL(0,0,SW,SH,bg) if keydown(KEY_BACKSPACE): sleep(0.2) den=n2=1 FILL(0,0,SW,SH,bg) if keydown(KEY_VAR) or energy<0: sleep(0.2) bg=(255,)*3 FILL(0,0,SW,SH,bg) MX,MY= 0,18 x,y= 11,58 if y>MY+1000: STR("Color(r,g,b) = "+str(bg),10,60) STR("hex="+str(hex(bg[0]))+","+str(hex(bg[1]))+","+str(hex(bg[2])),10,100) if keydown(KEY_OK): sleep(0.2) bg=(Rint(0,255),Rint(0,255),Rint(0,255)) FILL(0,0,SW,SH,bg) FILL(0,50,322,80,white) if keydown(KEY_SHIFT): sleep(0.2) try: num=int(input("n1: ")) except: num=1 FILL(0,0,SW,SH,bg) if keydown(KEY_ALPHA): sleep(0.2) try: den=int(input("n2: ")) except: den=1 FILL(0,0,SW,SH,bg) if x>MX+700: if keydown(KEY_UP): y-=10 if keydown(KEY_DOWN): y+=10 FILL(0,0,SW,SH,bg) STR("E:",5,200) FILL(30,200,int(energy),18,(0,255,0)) STR("Score: "+str(score),220,200) bx-=bs FILL(bx,by,bw,bh,bc) FILL(bx,by,2,bh,bc_2) FILL(bx+bw-2,by,2,bh,bc_2) FILL(bx,by,bw,2,bc_2) FILL(bx,by+bh-2,bw,2,bc_2) if bx<-10-bw: bx=Rint(400,600) by=Rint(-20,150) bw=Rint(40,100) bh=Rint(50,150) bc=(Rint(0,255),Rint(0,255),Rint(0,255)) bc_2=(Rint(0,255),Rint(0,255),Rint(0,255)) bs=Rint(8,20) score+=Rint(5,10) energy+=Rint(1,2) bg=(Rint(0,100),Rint(0,100),Rint(0,100)) if x+w>=bx and x<=bx+bw and y+h>=by and y<=by+bh: FILL(x,y,w,h,(255,0,0)) energy-=2 if energy<0: sleep(0.2) FILL(0,0,SW,SH,black) STR("GAME OVER",100,100,(255,0,0),black) sleep(2) bg=(255,)*3 FILL(0,0,SW,SH,bg) MX,MY= 0,18 x,y= 11,58 energy=35 if keydown(KEY_SQRT): sleep(0.1) try: n3=int(input("sqrt(")) STR("sqrt("+str(n3)+") = "+str(n3**0.5),x+20,y) except: n3=1 if keydown(KEY_ANS): sleep(0.2) if n3>=1: sleep(0.2) n3+=1 STR("sqrt("+str(n3)+") = "+str(n3**0.5),x+20,y) y+=20 if keydown(KEY_ZERO): sleep(0.2) c=(Rint(0,255),Rint(0,255),Rint(0,255)) if keydown(KEY_PI): sleep(0.2) draw_room() if keydown(KEY_DOT): sleep(0.15) STR(str(MX)+","+str(MY),5,1) STR(str((-1*MX)+x)+","+str((-1*MY)+y),230,1) if keydown(KEY_SHIFT): if keydown(KEY_SEVEN): sleep(0.2) bg=(Rint(0,255),Rint(0,255),Rint(0,255)) font_c=(Rint(0,255),Rint(0,255),Rint(0,255)) FILL(0,0,SW,SH,bg) if keydown(KEY_EIGHT): sleep(0.2) font_c=(Rint(0,255),Rint(0,255),Rint(0,255)) FILL(0,0,SW,SH,bg) if keydown(KEY_NINE): sleep(0.2) bg=(Rint(0,255),Rint(0,255),Rint(0,255)) FILL(0,0,SW,SH,bg) STR(str(bg),160,1) if keydown(KEY_THREE): sleep(0.02) draw_frac() if MY>212: rx-=15 speed=15 bg=white FILL(0,0,SW,SH,bg) FILL(0,20,322,2,red) FILL(0,180,322,2,red) FILL(x,y,w,h,c) STR(str(CH),CH_x,CH_y,font_c,white) STR("Score: "+str(score),200,1) CH_x-=15 if keydown(KEY_OK): FILL(x+12,y+7,322-x,Rint(1,3),(Rint(0,255),Rint(0,255),Rint(0,255))) if y+8>=CH_y and y+8<=CH_y+16: if keydown(KEY_OK): sleep(0.02) FILL(CH_x,CH_y,9,16,green) CH_x=choice([Rint(200,400),x+Rint(100,150)]) CH_y=choice([y,y,Rint(20,150),y]) CH=chr(Rint(33,126)) score+=Rint(1,5) if x+w>=CH_x and x<=CH_x+9 and y+h>=CH_y and y<=CH_y+16: FILL(0,0,SW,SH,red) score-=Rint(10,20) if CH_x<-15: CH_x=choice([Rint(200,400),x+Rint(100,150)]) CH_y=choice([y,y,Rint(20,150),y]) CH=chr(Rint(33,126)) score+=Rint(2,5) font_c=(Rint(0,180),Rint(0,180),Rint(0,180)) if y<=20 and y+h>=20: FILL(0,0,SW,SH,red) score-=5 if y<=180 and y+h>=180: FILL(0,0,SW,SH,red) score-=Rint(5,15) CH_y+=Rint(-3,3) STR("gcd("+str(n1)+","+str(n2)+") = "+str(gcd(n1,n2)),MX+40,MY-10) STR(str(MAT_1[0]),MX+40,MY-100) STR(str(MAT_1[1]),MX+40,MY-80) STR(str(MAT_1[2]),MX+40,MY-60) STR("Press [OK]",100,200,(0,0,0),(255,255,0)) print() print("bg=",bg) print() print("font_c=",font_c) print(MY)