J'ai divisé le code en plusieurs parties dont voici la principale :
- Code: Select all
:AxesOff
:FnOff
:ZInteger
:{0}→LC
:"0010"→Str2
:ClrDraw
:Input "SENTENCE:",Str1
:Text(1,1,"ANALYSING DATA")
:For(J,1,length(Str1))
:For(I,1,44)
:If sub(Str1,J,1)=sub("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ?θ*+-./:",I,1)
:Then
:I→L1(J)
:End
:If sub(Str1,J,1)="0"
:Then
:0→L1(J)
:End
:End
:End
:length(Str1)→B
:prgmBIN
:If length(Str1)>20
:Then
:Disp "YOUR SENTENCE IS TOO LONG"
:Stop
:Else
:{0,251,67,46,61,118,70,64,94,32,45}→LA
:End
:Text(1,1,"ENCODING DATA")
:If length(Str1)/2=int(length(Str1)/2)
:Then
:For(J,1,dim(L1),2)
:(L1(J)*45)+L1(J+1)→ B
:prgmBIN
:End
:Else
:For(J,1,dim(L1)-1,2)
:(L1(J)*45)+L1(J+1)→ B
:prgmBIN
:End
:L1(dim(L1))→B
:B→C
:prgmBIN
:End
:While length(Str2)/8≠int(length(Str2)/8)
:Str2+"0"→Str2
:End
:While length(Str2)≠128
:Str2+"11101100"→Str2
:If length(Str2)≠128
:Then
:Str2+"00010001"→Str2
:End
:End
:prgmERROR1
:0→B
:1→N
:For(I,128,8,-8
:For (J,I,I-7,-1)
:If sub(Str2,J,1)="1"
:Then
:B+2^(I-J)→B
:End
:End
:B→LC(N)
:0→B
:N+1→N
:End
:dim(LC→M
:For(L,1,int(M/2
:LC(L→Z
:LC(M-L+1→LC(L
:Z→LC(M-L+1
:End
:For(K,1,16)
:prgmERROR2
:End
:ClrListLANTI
:ClrListLLOG
:For(J,2,dim(LC)
:LC(J)→B
:prgmBIN
:End
:PrgmAFF
Ici le programme BIN :
- Code: Select all
:1→N
:{0}→L2
:While B≠0
:If B/2=int(B/2)
:Then
:0→L2(N)
:Else
:1→L2(N)
:End
:N+1→N
:int(B/2)→B
:End
:If length(Str2)=4
:Then
:While dim(L2)≠9
:0→L2(dim(L2)+1
:End
:Else
:If L1(dim(L1))=C
:Then
:While dim(L2)≠6
:0→L2(dim(L2)+1)
:End
:Else
:If dim(LC)>1
:Then
:While dim(L2)≠8
:0→L2(dim(L2)+1)
:End
:Else
:While dim(L2)≠11
:0→L2(dim(L2)+1)
:End
:End
:End
:End
:dim(L2→M
:For(L,1,int(M/2
:L2(L→Z
:L2(M-L+1→L2(L
:Z→L2(M-L+1
:End
:45→C
:"?
:For(I,1,dim(L2
:Ans+sub("01",1+L2(I),1
:End
:Str2+sub(Ans,2,length(Ans)-1→Str2
Là le programme ERROR :
- Code: Select all
:For(J,1,dim(LC))
:1 → N
:{0}→L5
:{0}→L6
:{0}→L1
:While L4(J)≠0
:If L4(J)/2=int(L4(J)/2)
:Then
:0→L5(N)
:Else
:1→L5(N)
:End
:N+1→N
:int(L4(J)/2)→L4(J)
:End
:1→N
:While LC(J)≠0
:If LC(J)/2=int(LC(J)/2)
:Then
:0→L6(N)
:Else
:1→L6(N)
:End
:N+1→N
:int(LC(J)/2)→LC(J)
:End
:While dim(L6)≠dim(L5)
:If dim(L6)>dim(L5)
:0→L5(dim(L5)+1)
:Else
:0→L6(dim(L6)+1)
:End
:End
:For(I,1,dim(L5))
:If L5(I)=L6(I)
:Then
:0→L1(I)
:Else
:1→L1(I)
:End
:End
:0→B
:For(I,1,dim(L1))
:If L1(I)=1
:Then
:B+2^(I-1)→B
:End
:End
:B→LC(J)
:End
Le programme ERROR1 :
- Code: Select all
:ClrDraw
:Text(1,1,"GENERATING:")
:Text(7,1,"POWERS OF 2")
:For(I,0,255)
:I→LLOG(I+1)
:End
:{256}→LC
:{1,2,4,8,16,32,64,128}→LANTI
:Text(7,1,"POWERS OF 2 IN GALOIS FIELD")
:For(K,9,256)
:If LC(1)>255
:Then
:LC → L4
:{285} → LC
:prgmERROR
:End
:LC(1)→ LANTI(K)
:LC(1)*2 → LC(1)
:End
Le programme ERROR2 :
- Code: Select all
:ClrList L4
:ClrDraw
:Text(1,1,"GENERATING:")
:Text(7,1,"ERROR CODE",K)
:If K>1
:Then
:For(I,2,dim(LC))
:LC(I)→LC(I-1)
:End
:dim(LC)-1 → dim(LC)
:End
:For(I,1,dim(LANTI))
:If LANTI(I)=LC(1)
:Then
:LLOG(I) → P
:dim(LANTI)+1 → I
:End
:End
:For(I,1,dim(LA))
:If P+LA(I)>255
:Then
:remainder(P+LA(I),255 → L4(I))
:Else
:P+LA(I) →L4(I)
:End
:End
:For(I,1,dim(L4))
:For(J,1,dim(LLOG))
:If LLOG(J)=L4(I)
:Then
:LANTI(J)→B
:End
:End
:B→L4(I)
:End
:While dim(L4)≠dim(LC)
:If dim(L4)<dim(LC)
:Then
:0→L4(dim(L4)+1)
:Else
:0→LC(dim(LC)+1)
:End
:End
:ClrDraw
:Text(1,1,"XORING CODE",K)
:prgmERROR
Et le programme AFF :
- Code: Select all
:41→A
:30→B
:1→K
:ZInteger
:ClrDraw
:RecallPic Pic2
:For(D,56,37,-2)
:For(J,A,B,-1)
:If J=27
:Then
:J-1→J
:End
:If sub(Str2,K,1)="1"
:Then
:Pxl-On(J,D)
:End
:If remainder(J+1,2)=0
:Then
:Pxl-Change(J,D)
:End
:If sub(Str2,K+1,1)="1"
:Then
:Pxl-On(J,D-1)
:End
:If remainder(J+1,2)=0
:Then
:Pxl-Change(J,D-1)
:End
:K+2→K
:End
:D-2→D
:If D=42
:Then
:D-1→D
:End
:For(J,B,A)
:If J=27
:Then
:J+1→J
:End
:If sub(Str2,K,1)="1"
:Then
:Pxl-On(J,D)
:End
:If remainder(J+1,2)=0
:Then
:Pxl-Change(J,D)
:End
:If sub(Str2,K+1,1)="1"
:Then
:Pxl-On(J,D-1)
:End
:If remainder(J+1,2)=0
:Then
:Pxl-Change(J,D-1)
:End
:K+2→K
:End
:If D=50
:Then
:B-9→B
:End
:If D=46
:Then
:B+9→B
:A-8→A
:End
:End
:"101000100100101"->Str3
:29→J
:36→D
:For(K,1,8)
:If D=42
:Then
:D+1→D
:End
:If sub(Str3,K,1)="1"
:Then
:Pxl-On(J,D)
:End
:D+1→D
:End
:44→D
:28→J
:For(K,9,15)
:If J=27
:Then
:J-1→J
:End
:If sub(Str3,K,1)="1"
:Then
:Pxl-On(J,D)
:End
:J-1→J
:End
:44→D
:1→K
:For(J,41,35,-1)
:If sub(Str3,K,1)="1"
:Then
:Pxl-On(J,D)
:End
:K+1→K
:End
:29→J
:8→K
:For(D,49,56)
:If sub(Str3,K,1)="1
:Then
:Pxl-On(J,D)
:End
:K+1→K
:End
Il manque l'image qui sert de base au qr code (la pic2) mais je ne sais pas trop comment la mettre ici.