0 Members and 5 Guests are viewing this topic.
:ClrHome:4→X:5→Y::Lbl A:Output(X,Y,"@":While 1:getKey→G:While G=0:getKey→G:End:If G=24:Then:Output(X,Y," ":Y-1→Y:Goto A:End::If G=25:Then:Output(X,Y," ":X-1→X:Goto A:End::If G=26:Then:Output(X,Y," ":Y+1→Y:Goto A:End::If G=34:Then:Output(X,Y," ":X+1→X:Goto A:End:::If G=45:Then:ClrHome:Stop:End::If G≠24 or 25 or 26 or 34:Goto A:End
ClrHome4->X5->YRepeat G=45Repeat Ggetkey->GEndOutput(X,Y," Y-(G=24)+(G=26->YX-(G=25)+(G=34->XOutput(X,Y,"@EndClrHomeStop
I'm betting someone will come up with that one Δlist trick in response to this, but I coded BASIC mostly years before that trick was made popular, so I don't know how it works and if it's any faster.
:4→A:8→B:Repeat K=21:getKey→K:If Ans:Output(A,B," // 1 space:min(8,max(1,A+sum(Δlist(Ans={25,34→A:min(16,max(1,B+sum(Δlist(K={24,26→B:Output(A,Ans,"X:End