-
Notifications
You must be signed in to change notification settings - Fork 0
/
meatπ bisr v12.py
1775 lines (1775 loc) · 39 KB
/
meatπ bisr v12.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import webbrowser as webr,time as tm,random as r,turtle as t,os,keyword as kw,math
A,B,C,E,I,K,L,M,N,O,P,Q,R,S,T,U,W,X=abs,bin,chr,eval,input,t.bk,len,min,open,ord,print,int,r.randint,str,t.fd,tm.sleep,range,max
s='Copyright (c) 2022 Python Source Code Collecting Org.\nCopyright (c) 2022 dgncx(c) Org.\nAll Rights Reserved.\n'
P(s)
class Dt:
try:
nums66,et47,wheel62,hfms,block27,blockcol27,map135,map235,map138,a23,refl62,inits2293,excepter=E(N('Meatpi_Data.dat','r').read())
except:
P('ERROR\nData file not found or not available.\nYou can goto g9mee.csb.app for the latest version of the data file.')
while 1:
pass
class Sz:
try:
ls=E(N('Meatpi_Settings.dat','r').read())
if L(ls)!=6:
excepter
except:
ls=[1,None,1,0.6,I('Username (will be saved):'),1]
N('Meatpi_Settings.dat','w').write(S(ls))
name=['sound','deleted','output clearing','time gap between functions','username','exceptions recording']
def clear():
if Sz.ls[2]==0:
return 0
if os.name=='nt':
_=os.system('cls')
else:
_=os.system('clear')
nowin=0
try:
import winsound
except:
nowin=1
Sz.ls[0]=0
N('Meatpi_Settings.dat','w').write(S(Sz.ls))
P('WARNING\nThe "winsound" module is not found in your computer.\nSound has been disabled automatically.')
I('Press Enter to continue')
def ok1(now,s):
if L(s)!=3 or s[0]<'A' or s[0]>'I' or Q(s[1:])<1 or Q(s[1:])>11 or s=='D06':
return 0
elif now[0]==s[0] and Q(s[1:])>Q(now[1:]) and not(now[0]=='D' and Q(s[1:])>6>Q(now[1:])):
return 1
elif now[1:]==s[1:] and O(now[0])>O(s[0]) and not(now[1:]=='06' and O(now[0])>O('D')>O(s[0])):
return 1
elif O(now[0])+Q(now[1:])==O(s[0])+Q(s[1:]) and O(now[0])>O(s[0]) and not(O(s[0])+Q(s[1:])==O('D')+6 and Q(s[1:])>6>Q(now[1:])):
return 1
else:
return 0
def ok2(now,s):
if L(s)!=3 or s[0]<'A' or s[0]>'K' or Q(s[1:])<1 or Q(s[1:])>13 or s=='D08' or s=='I03':
return 0
elif now[0]==s[0] and Q(s[1:])>Q(now[1:]) and not(now[0]=='D' and Q(s[1:])>8>Q(now[1:])) and not(now[0]=='I' and Q(s[1:])>3>Q(now[1:])):
return 1
elif now[1:]==s[1:] and O(now[0])>O(s[0]) and not(now[1:]=='08' and O(now[0])>O('D')>O(s[0])) and not(now[1:]=='03' and O(now[0])>O('I')>O(s[0])):
return 1
elif O(now[0])+Q(now[1:])==O(s[0])+Q(s[1:]) and O(now[0])>O(s[0]) and not(O(s[0])+Q(s[1:])==O('D')+8 and Q(s[1:])>8>Q(now[1:])) and not(O(s[0])+Q(s[1:])==O('I')+3 and Q(s[1:])>3>Q(now[1:])):
return 1
else:
return 0
def mst():
now=tm.time()
add=now-1595692800.0
tim=S(Q(add/86400*20000))
ln=L(tim)
tim=tim[0:ln-5]+':'+tim[ln-5]+':'+tim[ln-4:]
return tim
class c64:
vis=[]
def dfs64(mp64,x,y,col,m):
c64.vis[x][y]=1
res=1
if m=='64':
inbound=lambda x,y:(x>=0 and x<5 and y>=0 and y<5)
elif m=='65':
inbound=lambda x,y:(x>=0 and x<8 and y>=0 and y<8)
else:
inbound=lambda x,y:(x>=0 and x<6 and y>=0 and y<6)
dx,dy=[0,0,1,-1],[1,-1,0,0]
for i in W(4):
vx,vy=x+dx[i],y+dy[i]
if inbound(vx,vy):
if mp64[vx][vy]==col and not c64.vis[vx][vy]:
c64.vis[vx][vy]=1
res+=dfs64(mp64,vx,vy,col,m)
return res
def op66(modes,x,y,ds,dopr):
if ds:
P(S(x)+S(y)+'\n')
cor=[]
for i in W(7):
cor.append(Dt.nums66[x][i])
for i in W(7):
cor.append(Dt.nums66[y][i])
for i in W(14):
if modes[i]==1:
cor[i]=1
if modes[i]==2:
cor[i]=0
if modes[i]==3:
cor[i]=1-cor[i]
ch1=lambda x:Q(cor[x])*'_'+(1-Q(cor[x]))*' '
ch2=lambda x:Q(cor[x])*'|'+(1-Q(cor[x]))*' '
if dopr:
P(' '+ch1(0)+' '+ch1(7))
P(ch2(1)+ch1(3)+ch2(2)+' '+ch2(8)+ch1(10)+ch2(9))
P(ch2(4)+ch1(6)+ch2(5)+' '+ch2(11)+ch1(13)+ch2(12))
return cor
def read(k):
P()
P(Sz.name[k])
if k!=4:
P('current value:',Sz.ls[k])
else:
P("current value: '"+Sz.ls[k]+"'")
Sz.ls[k]=E(I('new value: '))
def gcd(a,b):
if a==1 or b==1:
return 1
elif a==0 or b==0:
return X(a,b)
else:
return gcd(b,a%b)
def fff(n,x):
a=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']
b=[]
while 1:
s=n//x
y=n%x
b=b+[y]
if s==0:
break
n=s
b.reverse()
re=''
for i in b:
res+=a[i]
return res
def getord62(c):
if O('a')<=O(c) and O('z')>=O(c):
return O(c)-O('a')
else:
return 26
def getchr62(x):
if 0<=x and 25>=x:
return C(O('a')+x)
else:
return ' '
def add62(c):
for i in W(5):
if c[-i-1]!=' ':
c=c[0:9-i]+getchr62(getord62(c[-1])+1)+c[10-i:]
break
else:
c=c[0:9-i]+'a'+c[10-i:]
return c
hfms=Dt.hfms
inits=Dt.inits2293
players=inits[0]
boxes=inits[1]
targs=inits[2]
def playhf(tm):
ops=['w','a','s','d']
dx=[-1,0,1,0]
dy=[0,-1,0,1]
P('stages:%d'%(L(hfms)))
for mp in hfms:
stage=hfms.index(mp)
U(1)
clear()
U(1)
player=players[stage]
box=boxes[stage]
targ=targs[stage]
boxfn=0
while not(boxfn) or player!=targ:
clear()
P("STAGE <%d>"%(stage+1))
for i in W(9):
for j in W(11):
s=''
if [i,j]==player:
s='i'
elif not(boxfn) and [i,j]==box:
s='@'
elif [i,j]==targ:
s='O'
elif mp[i][j]:
s='#'
else:
s='.'
P(s,end='')
P()
op=I('Operation:')
while not(op in ops):
op=I('ERROR Please try again:')
dirx=dx[ops.index(op)]
diry=dy[ops.index(op)]
onx=player[0]+dirx
ony=player[1]+diry
if boxfn and targ==[onx,ony]:
player=[onx,ony]
continue
if mp[onx][ony]:
continue
elif box!=[onx,ony]:
player=[onx,ony]
elif mp[onx+dirx][ony+diry]:
continue
else:
player=[onx,ony]
box=[onx+dirx,ony+diry]
if box==targ:
boxfn=1
class Gl:
do21,ss,run52=0,'',0
ads=[\
'''wtlocker.eu.org PSCCO官方推荐的一款实用的聊天网站,登录即可开聊,功能齐全,快来试试吧!''',\
'''g9mee.csb.app PSCCO官方指定的小程序下载处,有c也有py,快来玩吧!''',\
'']
def zip08():
ls=[]
allres=[]
allre2=[]
for i in W(4):
s='第'+S(i+1)+'个数:'
ls.append(Q(I(s)))
for i in W(4):
for j in W(4):
for k in W(4):
for l in W(4):
if i!=j and i!=k and i!=l and j!=k and j!=l and k!=l:
ls2=[ls[i],ls[j],ls[k],ls[l]]
for m in W(216):
res=S(ls2[0])
for now in W(1,4):
nowe=ls2[now]
po=(m%(6**(now)))//((6**(now-1)))
if po==0:
res+='+'+S(nowe)
if po==1:
res+='*'+S(nowe)
if po==2:
res+='-'+S(nowe)
if po==3:
res=S(nowe)+'-'+res
if po==4:
res+='/'+S(nowe)
if po==5:
res=S(nowe)+'/'+res
res='('+res+')'
try:
if A(E(res)-24)<=0.001:
allres.append(res)
except:
pass
for m in W(216):
re=''
re1=''
re2=''
o1=(m%6)//1
o2=(m%216)//36
o3=(m%36)//6
if o1==0:
re1='('+S(ls[0])+'+'+S(ls[1])+')'
if o1==1:
re1='('+S(ls[0])+'*'+S(ls[1])+')'
if o1==2:
re1='('+S(ls[0])+'-'+S(ls[1])+')'
if o1==3:
re1='('+S(ls[1])+'-'+S(ls[0])+')'
if o1==4:
re1='('+S(ls[0])+'/'+S(ls[1])+')'
if o1==5:
re1='('+S(ls[1])+'/'+S(ls[0])+')'
if o2==0:
re2='('+S(ls[2])+'+'+S(ls[3])+')'
if o2==1:
re2='('+S(ls[2])+'*'+S(ls[3])+')'
if o2==2:
re2='('+S(ls[2])+'-'+S(ls[3])+')'
if o2==3:
re2='('+S(ls[3])+'-'+S(ls[2])+')'
if o2==4:
re2='('+S(ls[2])+'/'+S(ls[3])+')'
if o2==5:
re2='('+S(ls[3])+'/'+S(ls[2])+')'
if o3==0:
re='('+re1+'+'+re2+')'
if o3==1:
re='('+re1+'*'+re2+')'
if o3==2:
re='('+re1+'-'+re2+')'
if o3==3:
re='('+re2+'-'+re1+')'
if o3==4:
re='('+re1+'/'+re2+')'
if o3==5:
re='('+re2+'/'+re1+')'
try:
if A(E(re)-24)<=0.0001:
allres.append(re)
except:
pass
for res in allres:
if not(res in allre2):
allre2.append(res)
P(res)
if L(allres)==0:
P('无法算出24!')
def zip21():
import turtle as t
if Gl.do21:
t2.clear()
t2.shape('blank')
Gl.do21=1
t.clear()
t.color('black')
t.up()
t.goto(0,0)
t.down()
t.seth(0)
t.speed(0)
t.shape('square')
t2=t.Turtle()
t2.up()
t2.shape('square')
t2.goto(110,110)
lsa=['I','H','G','F','E','D','C','B','A','']
lsb=['01','02','03','04','05','06','07','08','09','10','11','']
keypoint=['E03','H07','D05','F08','B09','C10','A11']
for i in W(10):
T(220);K(220)
t.up()
t.rt(180);T(20)
t.write(lsa[i],font=('Arial',16))
K(20);t.lt(180)
t.down()
if i!=9:
t.lt(90);T(20);t.rt(90)
t.up()
t.goto(0,0)
t.down()
t.lt(90)
for i in W(12):
T(180);K(180)
t.up()
t.rt(180);T(20)
t.write(lsb[i],font=('Arial',9))
K(20);t.lt(180)
t.down()
if i!=11:
t.rt(90);T(20);t.lt(90)
t.up()
t.goto(10,10)
t.down()
s='I01'
x=I('谁先来(电脑先来输入1,你先来输入2)?')
if x=='2':
while s!='A11':
t.color('blue')
s2=I('你想走到哪里?')
while not ok1(s,s2):
s2=I('走不到,请重新输入:')
s=s2
t.goto(lsb.index(s2[1:])*20+10,lsa.index(s2[0])*20+10)
U(0.3)
for i in keypoint:
if ok1(s,i):
t.color('red')
P('电脑决定走到',i)
s=i
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
P('电脑赢了!!!')
else:
while 1:
t.color('red')
m=1
for i in keypoint:
if ok1(s,i):
P('电脑决定走到',i)
m=0
s=i
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
if m:
cc=R(1,4)
if cc==1 and ok1(s,C(O(s[0])-1)+s[1:]):
P('电脑决定走到',C(O(s[0])-1)+s[1:])
s=C(O(s[0])-1)+s[1:]
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
elif cc==2 and ok1(s,s[0]+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)):
s=s[0]+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)
P('电脑决定走到',s)
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
else:
s=C(O(s[0])-1)+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)
P('电脑决定走到',s)
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
if s=='A11':
P('电脑赢了!!!')
break
t.color('blue')
s2=I('你想走到哪里?')
while not ok1(s,s2):
s2=I('走不到,请重新输入:')
s=s2
t.goto(lsb.index(s2[1:])*20+10,lsa.index(s2[0])*20+10)
U(0.3)
if s=='A11':
P('你赢了!!!')
break
t.up()
def zip22():
t.clear()
t.speed(0)
t.seth(0)
t.shape('classic')
t.color('black')
t.up()
t.goto(0,0)
if Gl.do21:
t2.clear()
t2.shape('blank')
t.goto(-150,-150)
t.down()
for i in W(-150,151,15):
t.goto(i,-150)
t.lt(90);T(300);K(300)
if i!=150:
t.up()
K(16)
t.write(i//15+11,font=('Arial',8))
T(16)
t.down()
t.rt(90)
for i in W(-150,151,15):
t.goto(-150,i)
T(300);K(300)
if i!=150:
t.up()
K(16)
t.write(i//15+11,font=('Arial',8))
T(16)
t.down()
while 1:
inp=I('''1.把一个格子涂上颜色
2.把从 x1,y1(左下角) 到 x2,y2(右上角) 的格子涂上颜色
3.退出
4.x1,y1 到 x2,y2 的那条线涂上颜色
填序号:''')
if inp=='1':
x=Q(I('请输入格子的横坐标:'))
y=Q(I('请输入格子的纵坐标:'))
c=B(Q(I('请输入颜色(黑:0 蓝:1 绿:2 青:3 红:4 紫:5 黄:6 白:7):')))
c=c[:2]+(5-L(c))*'0'+c[2:]
t.up()
t.goto((x-1)*15-150,(y-1)*15-150)
t.down()
t.fillcolor(Q(c[2]),Q(c[3]),Q(c[4]))
t.begin_fill()
for k in W(4):
T(15);t.lt(90)
t.end_fill()
elif inp=='4':
x1=Q(I('请输入第1个点的横坐标:'))
y1=Q(I('请输入第1个点的纵坐标:'))
x2=Q(I('请输入第2个点的横坐标:'))
y2=Q(I('请输入第2个点的纵坐标:'))
if x1>x2:
x1,y1,x2,y2=x2,y2,x1,y1
c=B(Q(I('请输入颜色(黑:0 蓝:1 绿:2 青:3 红:4 紫:5 黄:6 白:7):')))
c=c[:2]+(5-L(c))*'0'+c[2:]
t.fillcolor(Q(c[2]),Q(c[3]),Q(c[4]))
for x in W(x1,x2+1):
try:
y=Q(y1+((x-x1)/(x2-x1))*(y2-y1))
except:
y=y1
t.up()
t.goto((x-1)*15-150,(y-1)*15-150)
t.down()
t.begin_fill()
for k in W(4):
T(15);t.lt(90)
t.end_fill()
if y1<=y2:
for y in W(y1,y2+1):
try:
x=Q(x1+((y-y1)/(y2-y1))*(x2-x1))
except:
x=x1
t.up()
t.goto((x-1)*15-150,(y-1)*15-150)
t.down()
t.begin_fill()
for k in W(4):
T(15);t.lt(90)
t.end_fill()
else:
for y in W(y2,y1+1):
try:
x=Q(x1+((y-y2)/(y1-y2))*(x2-x1))
x=x2-(x-x1)
except:
x=x1
t.up()
t.goto((x-1)*15-150,(y-1)*15-150)
t.down()
t.begin_fill()
for k in W(4):
T(15);t.lt(90)
t.end_fill()
elif inp=='2':
x1=Q(I('请输入左下角的横坐标:'))
y1=Q(I('请输入左下角的纵坐标:'))
x2=Q(I('请输入右上角的横坐标:'))
y2=Q(I('请输入右上角的纵坐标:'))
c=B(Q(I('请输入颜色(黑:0 蓝:1 绿:2 青:3 红:4 紫:5 黄:6 白:7):')))
c=c[:2]+(5-L(c))*'0'+c[2:]
t.fillcolor(Q(c[2]),Q(c[3]),Q(c[4]))
for x in W(x1,x2+1):
for y in W(y1,y2+1):
t.up()
t.goto((x-1)*15-150,(y-1)*15-150)
t.down()
t.begin_fill()
for k in W(4):
T(15);t.lt(90)
t.end_fill()
elif inp=='3':
break
else:
P('输入无效')
for i in W(5):
P()
def zip24():
import turtle as t
if Gl.do21:
t2.clear()
t2.shape('blank')
Gl.do21=1
t.clear()
t.color('black')
t.up()
t.goto(0,0)
t.down()
t.seth(0)
t.speed(0)
t.shape('square')
t2=t.Turtle()
t2.up()
t2.shape('square')
t2.goto(150,150)
t2.stamp()
t2.goto(50,50)
lsa=['K','J','I','H','G','F','E','D','C','B','A','']
lsb=['01','02','03','04','05','06','07','08','09','10','11','12','13','']
keypoint=['G02','J08','E05','H09','D07','F10','B11','C12','A13']
for i in W(12):
T(260);K(260)
t.up()
t.rt(180);T(20)
t.write(lsa[i],font=('Arial',16))
K(20);t.lt(180)
t.down()
if i!=11:
t.lt(90);T(20);t.rt(90)
t.up()
t.goto(0,0)
t.down()
t.lt(90)
for i in W(14):
T(220);K(220)
t.up()
t.rt(180);T(20)
t.write(lsb[i],font=('Arial',9))
K(20);t.lt(180)
t.down()
if i!=13:
t.rt(90);T(20);t.lt(90)
t.up()
t.goto(10,10)
t.down()
s='K01'
x=I('谁先来(电脑先来输入1,你先来输入2)?')
if x=='2':
while s!='A13':
t.color('blue')
s2=I('你想走到哪里?')
while not ok2(s,s2):
s2=I('走不到,请重新输入:')
s=s2
t.goto(lsb.index(s2[1:])*20+10,lsa.index(s2[0])*20+10)
U(0.3)
for i in keypoint:
if ok2(s,i):
t.color('red')
P('电脑决定走到',i)
s=i
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
P('电脑赢了!!!')
else:
while 1:
t.color('red')
m=1
for i in keypoint:
if ok2(s,i):
P('电脑决定走到',i)
m=0
s=i
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
if m:
cc=R(1,4)
if cc==1 and ok2(s,C(O(s[0])-1)+s[1:]):
P('电脑决定走到',C(O(s[0])-1)+s[1:])
s=C(O(s[0])-1)+s[1:]
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
elif cc==2 and ok2(s,s[0]+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)):
s=s[0]+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)
P('电脑决定走到',s)
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
else:
s=C(O(s[0])-1)+((Q(s[1:])+1)<10)*'0'+S(Q(s[1:])+1)
P('电脑决定走到',s)
t.goto(lsb.index(s[1:])*20+10,lsa.index(s[0])*20+10)
if s=='A13':
P('电脑赢了!!!')
break
t.color('blue')
s2=I('你想走到哪里?')
while not ok2(s,s2):
s2=I('走不到,请重新输入:')
s=s2
t.goto(lsb.index(s2[1:])*20+10,lsa.index(s2[0])*20+10)
U(0.3)
if s=='A13':
P('你赢了!!!')
break
t.up()
def runfunc(m):
clear()
if m=='01':
try:
q=I('请输入算式(不带=):')
q_ev=E(q)
P('答案是:',q_ev)
except ZeroDivisionError:
P('算式中含有除以0,无法计算')
except:
P('无法计算')
elif m=='02':
while 1:
inp=I('''1.输出1到x以内的质数
2.输出x到y的质数
3.判断x是不是质数
4.退出
填1,2,3或4:''')
bl=1
if inp=='1':
inp_1=E(I('x? '))
ls=[]
for i in W(inp_1+1):
ls.append(1)
for inp_el in W(2,inp_1+1):
if ls[inp_el]==1:
for k in W(inp_el**2,inp_1+1,inp_el):
ls[k]=0
ls2=[]
for i in W(2,inp_1+1):
if ls[i]==1:
ls2.append(i)
P(ls2)
P('计数:',L(ls2))
elif inp=='2':
ls=[]
inp_4_1=E(I('x? '))
inp_4_2=E(I('y? '))
ls=[]
for i in W(inp_4_2+1):
ls.append(1)
for inp_el in W(2,inp_4_2+1):
if ls[inp_el]==1:
for k in W(inp_el**2,inp_4_2+1,inp_el):
ls[k]=0
ls2=[]
for i in W(2,inp_4_2+1):
if ls[i]==1 and i>=inp_4_1:
ls2.append(i)
P(ls2)
P('计数:',L(ls2))
elif inp=='3':
inp_2=E(I('x? '))
if inp_2<=1:
P('不是')
for i in W(5):
P()
continue
for cpr_num in W(2,inp_2):
if inp_2%cpr_num==0:
P('不是')
bl=0
break
if bl:
P('是')
elif inp=='4':
break
else:
P('输入无效')
for i in W(5):
P()
elif m=='03':
s=E(I('数列首项? '))
e=E(I('数列末项? '))
while 1:
q=I('输入公差回答1,输入个数回答2:')
if q=='1':
d=E(I('公差? '))
n=(e-s)/d+1
elif q=='2':
n=E(I('个数? '))
else:
P('输入无效')
continue
P('答案是',(s+e)*n/2)
break
elif m=='04':
a=E(I('分子? '))
b=E(I('分母? '))
i=2
while i<((a+b)-A(a-b))/2+1:
if a%i==0 and b%i==0:
a,b=a/i,b/i
else:
i+=1
P('化简后的分数是:',Q(a),'/',Q(b))
elif m=='05':
n=Q(I('要转换的数是? '))
x=Q(I('要转换成多少进制? '))
P(fff(n,x))
elif m=='06':
q=I('要转换的数是? ')
nm=Q(I('这个数是多少进制的? '))
try:
P(Q(q,nm))
except:
P("数据输入错误")
elif m=='07':
a=E(I('第一个数是几? '))
b=E(I('第二个数是几? '))
P('答案是',math.lcm(a,b))
elif m=='08':
zip08()
elif m=='09':
ri=0
ttime=0
q=Q(I('一共要多少道题?'))
for cd in [3,2,1]:
P(cd)
U(1)
for n in W(1,q+1):
a=R(1,100)
b=R(1,100)
start=tm.time()
P('第%i道题:%i+%i='%(n,a,b),end='')
re_i=Q(I(''))
end=tm.time()
ttime+=end-start
if re_i==a+b:
P('答对了!')
ri+=1
else:
P('答错了...')
P('平均时间:%.2f 秒'%(ttime/q))
P('正确率:',ri/q*100,'%')
P('分数:%.2f(超过100就算厉害的啦)'%(ri/q*100/(ttime/q/2.8)))
elif m=='10':
ttime,tlen=0,0
ri=0
q=Q(I('一共要多少道题?'))
for cd in [3,2,1]:
P(cd)
U(1)
for n in W(1,q+1):
kwc=r.choice(kw.kwlist)
P(kwc,end=' 请打出相同的单词:')
start=tm.time()
kwcin=I()
end=tm.time()
ttime,tlen=ttime+(end-start),tlen+L(kwc)
if kwcin==kwc:
ri+=1
P('打出一个字母用的平均时间:%.2f 秒'%(ttime/tlen))
P('正确率:',ri/q*100,'%')
P('T值:%d (作者亲测227)'%(Q(tlen/ttime*ri/q*100)))
elif m=='11':
bl=Q(I("你要选一个从0到n的数,让电脑猜你选的是哪个数,请输入n:"))
q=S(bl)
nm=2
ql=L(q)
q=E(q)
a=''
while q!=0:
w=q%nm
if w>10:
w=l[n.index(w)]
a+=S(w)
q=Q(q/nm)
a=a[::-1]
l=L(a)
P('请选一个从0到%d的数,记在心里,想好了按回车'%(bl),end='')
I()
inp=[]
ls=[]
for i in W(0,2**l):
a=B(i)[2:]
for i in W(l-L(a)):
a='0'+a
ls.append(a)
for i in W(l):
tda=[]
for tn in ls:
if (tn[0-(i+1)]=='1'):
tda.append(tn)
tda2=[]
for tt in tda:
tt2=0
for j in W(L(tt)):
tt2+=(2**j)*Q(tt[0-(j+1)])
if tt2<=bl:
tda2.append(tt2)
P('这个数在',tda2,'里吗?(否:0,是:1)')
inp.append(Q(I()))
it=0
for i in W(l):
it+=(2**i)*inp[i]
P('你选的数是',it)
elif m=='12':
a=E(I('第一个数是几? '))
b=E(I('第二个数是几? '))
for i in W(1,M(a,b)+1)[::-1]:
if a%i==0 and b%i==0:
P('答案是',i)
break
elif m=='13':
ls=[]
P('''二元一次方程标准形式:
ax+by+c=0
dx+ey+f=0''')
for i in ['a','b','c','d','e','f']:
ls.append(E(I(('请输入'+i+':'))))
a,b,c,d,e,f=ls[0],ls[1],ls[2],ls[3],ls[4],ls[5]
P('x =',(c*e-b*f)/(b*d-a*e))
P('y =',(c*d-a*f)/(a*e-b*d))
elif m=='14':
P('''一元二次方程标准形式:
ax²+bx+c=0''')
a=E(I('请输入a:'))
b=E(I('请输入b:'))
c=E(I('请输入c:'))
if (0-(c/a))>=0:
if b/2/a>=0:
P('x = sqrt(',(b*b-4*a*c)/(4*a*a),') -',b/2/a,'(',((b*b-4*a*c)/(4*a*a))**0.5-b/2/a,'or',0-((b*b-4*a*c)/(4*a*a))**0.5-b/2/a,')')
else:
P('x = sqrt(',(b*b-4*a*c)/(4*a*a),') +',0-(b/2/a),'(',(b*b-4*a*c)/(4*a*a)**0.5-b/2/a,'or',0-((b*b-4*a*c)/(4*a*a))**0.5-b/2/a,')')
else:
P('无实数解')
elif m=='15':
n=Q(I('请输入想分解的数:'))
if n<1:
P('无法分解')
else:
ls=[]
x=2
while n!=1:
while n%x==0:
n/=x
ls.append(x)
x+=1
P('分解后的列表',ls)
elif m=='20':
ls=[0]*10
qu=Q(I('要计算到小数点后第几位?'))
co,k,a,b,a1,b1=-1,2,4,1,12,4
while 1:
p,q,k=k*k,2*k+1,k+1
a,b,a1,b1=a1,b1,p*a+q*a1,p*b+q*b1
d,d1=a/b,a1/b1
while d==d1:
if co==-1:
P(Q(d),end='.')
else:
P(Q(d),end='')
ls[Q(d)]+=1
co,a,a1=co+1,10*(a%b),10*(a1%b1)
d,d1=a/b,a1/b1
if co==qu:
break
if co==qu:
break
P('\n数字个数,包括个位的3:')
for i in W(10):
P(i,':',ls[i],'个')
elif m=='21':
zip21()
elif m=='22':
zip22()
elif m=='23':
if not(Sz.ls[0]):
P('你似乎可能也许大概没开声音...?')
U(0.8)
return
P("键盘上q-u,z-k分别对应低音1到高音1,键盘上的2,3,5,6,7,s,d,g,h,j分别对应低音1到高音1间的所有升降音,空格代表空拍")
a=Dt.a23
s=I()
for j in s:
if j!=' ':
x=Q(245*2**(a.index(j)/12))
P(j)
winsound.Beep(x,200)
for i in W(4000000):
pp=1
else:
for i in W(6000000):
pp=1
elif m=='24':
zip24()
elif m=='26':
P('电脑将随机生成一个n位数,你每次猜一个n位数。电脑会告诉你对了几个数字。')
n=Q(I('n是几?'))
x=S(R(10**(n-1),10**n-1))
a=I('你猜是几?')
while a!=x:
n1,n2=0,0
for i in W(n):
n1+=Q(a[i]==x[i])
n2+=Q(a[i] in x and a[i]!=x[i])
P('位置且数字正确%d个,仅数字正确%d个。'%(n1,n2))
a=I('你猜是几?')
P('猜对了!')
elif m=='27':
score=0
block=Dt.block27
blockcol=Dt.blockcol27
a=[]
for i in W(20):
a.append([0]*20)
f=15
while f:
for c in W(1,9):
P('.',end='')
f-=1
P()
while 1:
typ=R(1,9)
score+=blockcol[typ]*2
P('方块:')
for i in W(3):
for j in W(3):
if block[typ][i][j]:
P('#',end='')
else:
P('.',end='')
P()
col=Q(I('放在第几列?'))
while col+blockcol[typ]>9:
col=Q(I('无效列数,请重新输入:'))
clear()
brk=1
place=15
while place:
for i in W(3):
for j in W(3):
if a[place-i+2][col+j] and block[typ][i][j]:
brk=0
break
if brk==0:
break
if brk==0:
break
place-=1
place+=1
for i in W(3):
for j in W(3):
if block[typ][i][j]:
a[place-i+2][col+j]=block[typ][i][j]
f=15
while f:
bl=1
for k in W(1,9):
if a[f][k]==0:
bl=0
if bl:
score+=12
for x in W(f,15):
for c in W(1,9):
a[x][c]=a[x+1][c]
a[15]=[0]*20
f-=1
f=15
while f:
for c in W(1,9):
if a[f][c]: