0 Members and 1 Guest are viewing this topic.

PROGRAM:MOVE"//////////////// //I broke this string down into rows of 16 (the first line is 17 though) so it is easier to follow. It would normally be typed on one line./___///___///__//_///___///__/_//______/////___//__///__///__/_//_////__//__/////______________/////////////////?Str1Output(1,1,Ans2?A2?BRepeat 0Output(A,B,"*Repeat AnsgetKey?KEndOutput(A,B,"_A+(Ans=34 and sub(str1,16A+B,1)="_")-(Ans=25 and sub(Str1,16A-32+B,1)="_?AB+(K=26 and sub(Str1,16A-15+B,1)="_")-(K=24 and sub(Str1,16A-17+B,1)="_?BEnd

/////////////////___///___///__//_///___///__/_//______/////___//__///__///__/_//_////__//__/////______________/////////////////

PROGRAM:TESTrandInt(0,100?ADisp A>25 and A<75

PROGRAM:TEST"ABCDEFGHIJKL?Str1sub(Str1,3,8 //The string, starts at the third character, goes eight out.This will display:prgmTESTCDEFGHIJ

PROGRAM:TESTsub("ABCDEFGHIJKL",3,8

PROGRAM:MOVE2"/////////////////___///___///__//_///___///__/_//______/////___//__///__///__/_//_////__//__/////______________/////////////////?Str1Output(1,1,AnsDelVarC2?A2?BRepeat AB=30Output(A,B,"*AB?DRepeat AnsgetKey?KEndOutput(A,B,"_A+(Ans=34 and sub(str1,16A+B,1)="_")-(Ans=25 and sub(Str1,16A-32+B,1)="_?AB+(K=26 and sub(Str1,16A-15+B,1)="_")-(K=24 and sub(Str1,16A-17+B,1)="_?BIf AB<D or AB>DC+1?CEndClrHomeDisp "YOUR SCORE:",C

:"XX XXXXXXXXXXXX XX ....... X . . X . .. . X . ... X . XXXXXXXXXXX →Str1:Output(1,1,Ans:4→R:8→C:Output(4,8,"π:Repeat K=45:Repeat max(Ans={24,25,26,34,45:getKey→K:End:If K=45:Return:Output(R,C,sub(Str1,16R-16+C,1:min(8,max(1,R+(K=34)-(K=25:If inString(" .",sub(Str1,16Ans-16+C,1:Ans→R:min(16,max(1,C+(K=26)-(K=24:If inString(" .",sub(Str1,16R-16+Ans,1:Ans→C:Output(R,C,"π:End

What if you want to traverse more than just spaces? If you tested each individually with sub(), things would get big fast, so for this case I would recommend a string of characters you can move over and check the inString("characters","where-you're-moving-to")(or a string of characters you can't move over, if there's less of those. Just use not(inString(... instead)For example,Code: [Select]:"XX XXXXXXXXXXXX XX ....... X . . X . .. . X . ... X . XXXXXXXXXXX →Str1:Output(1,1,Ans:4→R:8→C:Output(4,8,"π:Repeat K=45:Repeat max(Ans={24,25,26,34,45:getKey→K:End:If K=45:Return:Output(R,C,sub(Str1,16R-16+C,1:min(8,max(1,R+(K=34)-(K=25:If inString(" .",sub(Str1,16Ans-16+C,1:Ans→R:min(16,max(1,C+(K=26)-(K=24:If inString(" .",sub(Str1,16R-16+Ans,1:Ans→C:Output(R,C,"π:End

@Meishe91: It's While This Is True, and Repeat Until This Is True, that's why one's zero and the other's one. Other than that, great tutorial. I really learned something.

By the way, how many people would find a String to Matrix, Matrix to String, String to list, etc. for converting tile based maps?