0 Members and 2 Guests are viewing this topic.
ClrHome"3221110000→Str2"MH →Str10identity(16→[A]DelVar TDelVar SDelVar LRepeat S=20 and T=20ClrHomeFor(A,1,8Output(A,9-8L,"++++++++EndOutput(1,9-8L,"PLAYEROutput(1,16-8L,L+11→X1→YDelVar G1→RRepeat R=11Repeat K=21For(A,0,expr(sub(Str2,R,1Output(X+AG,Y+Anot(G)+8L,sub("* ",2-[A](X+AG,Y+Anot(G)+8L),1EndIf Ans=31not(G→Gmin(8-Gexpr(sub(Str2,R,1)),max(1,X+sum(DeltaList(K={25,34→Xmin(8-not(G)expr(sub(Str2,R,1)),max(1,Y+sum(DeltaList(K={24,26→YFor(A,0,expr(sub(Str2,R,1Output(X+AG,Y+Anot(G)+8L,"*EndRepeat AnsgetKey→KEndEndDelVar HFor(A,0,expr(sub(Str2,R,1H+[A](X+AG,Y+Anot(G)+8L→HEndIf not(HThenFor(A,0,expr(sub(Str2,R,11→[A](X+AG,Y+Anot(G)+8LEndIf LT+1+expr(sub(Str2,R,1→TIf not(LS+1+expr(sub(Str2,R,1→SR+1→REndEndnot(L→LEnd1→XAns→YrandInt(0,1→LLbl 1Repeat S=0 xor T=0ClrHomeFor(A,1,8Output(A,1+8L,"++++++++EndOutput(1,1+8L,"PLAYEROutput(1,8+8L,L+1For(A,1,8For(B,9-8L,16-8LOutput(A,B,sub(Str1,4-[A](A,B),1EndEnd1→X9→YRepeat K=21Output(X,Y-8L,sub(Str1,4-[A](X,Y-8L),1min(8,max(1,X+sum(DeltaList(K={25,34→Xmin(16,max(9,Y+sum(DeltaList(K={24,26→YOutput(X,Y-8L,"SOutput(3,4+8L,sub("ABCDEFGH",X,1Output(3,5+8L,Y-8Repeat AnsgetKey→KEndEndIf 1<[A](X,Y-8LThenOutput(5,1+8L,"TRYOutput(6,4+8L,"AGAINPause Goto 1EndIf not([A](X,Y-8LThenOutput(5,3+8L,"MISS3→[A](X,Y-8Lnot(L→LPause Goto 1EndIf 1=[A](X,Y-8LThenOutput(5,3+8L,"HIT!If LT-1→TIf not(LS-1→S2→[A](X,Y-8Lnot(L→LPause EndEndEndDelVar [A]ClrHomenot(L→LOutput(4,5,"PLAYEROutput(4,12,L+1Output(5,7,"WON!
{8,8→dim([A]Ans→dim([B]
0identity(8->[A]Ans->[B]
B+(K=34)-(K=25min(8,max(1,Ans→BC+(K=26)-(K=24min(16,max(9,Ans→C
min(8,max(1,B+(K=34)-(K=25->Bmin(16,max(9,C+(K=26)-(K=24->C
If Ans=31G+not(G)-(G=1→GEnd
If Ans=31not(G->GEnd
Delvar[A]Delvar[B]
1000001000001000001000001
no, problem meishe! (:identity(A) creates a matrix A rows by A columns, with every number being 0 except for the diagonals.so identity(5) creates:Code: [Select]1000001000001000001000001in my trick you have 0identity(, which creates an 8x8 matrix then multiplies it by 0, creating an 8x8 0-filled matrix (: also, i'm curious: when you have a player move their pieces around, are you drawing the whole map every time they move?
DelVar ADelVar GDelVar DDelVar E"4332221111→Str2"MH →Str10identity(8→[A]Ans→[B]1→B1→CRepeat A=21→RFor(θ,1,8Output(θ,9-8A,"********EndOutput(1,9-8A,"PLAYEROutput(1,16-8A,A+1For(I,1,8For(J,1,8If AOutput(I,J+8,[B](B,CIf not(AOutput(I,J,[A](B,CEndEndRepeat R=11Repeat K=21For(Q,0,expr(sub(Str2,R,1))-1Output(B+QG,C+Qnot(G)+8A,(A=1)[B](B,C)+not(A)[A](B,CEndIf K=31not(G→Gmin(8-Gexpr(sub(Str2,R,1))+G,max(1,B+(K=34)-(K=25→Bmin(8-not(G)expr(sub(Str2,R,1))+not(G),max(1,C+(K=26)-(K=24→CFor(Q,0,expr(sub(Str2,R,1))-1Output(B+QG,C+Qnot(G)+8A,sub(Str2,R,1EndRepeat AnsgetKey→KEndEndFor(Q,0,expr(sub(Str2,R,1))-1If Aexpr(sub(Str2,R,1→[B](B+Q(G=1),C+Qnot(GIf not(Aexpr(sub(Str2,R,1→[A](B+Q(G=1),C+Qnot(GEndR+1→REndA+1→A1→BAns→CEnd1→B9→CDelVar ARepeat E>49 or D>49ClrHomeFor(I,1,8For(J,1,8If AOutput(I,J,sub(Str1,7-[A](I,J),1If not(AOutput(I,J+8,sub(Str1,7-[B](I,J),1EndEndFor(θ,1,8Output(θ,1+8A,"********EndOutput(1,1+8A,"PLAYEROutput(1,8+8A,A+1Repeat K=21If AOutput(B,C-8,sub(Str1,7-[A](B,C-8),1If not(AOutput(B,C,sub(Str1,7-[B](B,C-8),1min(8,max(1,B+(K=34)-(K=25→Bmin(16,max(9,C+(K=26)-(K=24→COutput(B,C-8A,"SOutput(3,4+8A,sub("ABCDEFGH",B,1Output(3,5+8A,C-8Repeat AnsgetKey→KEndEndIf AThenIf [A](B,C-8ThenD+[A](B,C-8→D5→[A](B,C-8Output(6,11,"HIT!Else6→[A](B,C-8Output(7,11,"MISSEndElseIf [B](B,C-8ThenE+[B](B,C-8→E5→[B](B,C-8Output(6,3,"HIT!Else6→[B](B,C-8Output(7,3,"MISSEndEndPause A+not(A)-(A=1→AEndClrHomeOutput(4,5,"PLAYEROutput(4,12,AOutput(5,7,"WON!