? 🅱️ode 🅱️ritique (Page 3) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

🅱️ode 🅱️ritique

1 2 3
  • #41 ✎ 922 snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself This doesnt return a string which could cause an error. Allow me to improve that for you. DEF RND$() RETURN FORMAT$("%D",RNDF()) END Posted
  • #42 ✎ 961 Y_ack Head Admin The last answer returned a string which might have numbers in it, which might cause erroneous behavior if the caller does not expect numbers in a string. Allow me to improve that for you. Edit: I messed up! DEF RNDWOD$() VAR S$ = FORMAT$("%F",RNDF()) VAR I = 0, C$ WHILE I < LEN(S$) C$ = S$[I] 'remove char if it is a digit IF C$>="0"&&C$<="9" THEN S$[I]="" ELSE INC I,1 WEND RETURN S$ END Posted Edited by Y_ack
  • #43 ✎ 1665 12Me21 Head Admin Third Year My account is over 3 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself VAR PI$=STR$(PI()) VAR I 'Returns the next digit of pi when called DEF RND$() INC I I=I%LENGTH(PI$) 'make sure the index doesn't exceed the length of PI$ RETURN PI$[I] END 'get the length of a string DEF LENGTH S$ VAR I WHILE MID$(S$,I,1)!="" 'MID$ returns an empty string when out of range INC I WEND RETURN I END Posted
  • #44 ✎ 373 Chemicalex Drawing I like to draw! Hobbies RNG Hidden Easter Eggs Third Year My account is over 3 years old Website Does it have to be Smile🅱️asic code? Posted
  • #45 ✎ 317 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength nah just get a random string like this: DEF RNDS() RETURN INPUT END or Lua: local a = "" function rndString(_len) for i = 1, math.random(_len) do a..string.char(math.random(255)) end return a end Posted Edited by spaceturtles
  • #46 ✎ 1665 12Me21 Head Admin Third Year My account is over 3 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself
    nah just get a random string like this: DEF RNDS() RETURN INPUT END
    That doesn't even work
    Posted
  • #47 ✎ 317 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    nah just get a random string like this: DEF RNDS() RETURN INPUT END
    That doesn't even work
    the idea does?
    Posted
  • #48 ✎ 1665 12Me21 Head Admin Third Year My account is over 3 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself
    this is 🅱️ode 🅱️ritique, not 🅱️idea 🅱️ritique
    Posted
  • #49 ✎ 317 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    this is 🅱️ode 🅱️ritique, not 🅱️idea 🅱️ritique
    English with emotes isn't a programming language
    Posted
  • #50 ✎ 1665 12Me21 Head Admin Third Year My account is over 3 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Can someone please help improve my sorting function? It's too slow... DEF SORT_ARRAY (ARRAY[] ) DIM NEW [0] FOR J = 0 TO LEN(ARRAY) -1 FOR I=0 TO LEN(ARRAY) - 1 IF ARRAY[I] == MIN(ARRAY) THEN PUSH NEW, ARRAY[I] ARRAY[ I] = MAX( ARRAY ) BREAK ENDIF NEXT NEXT RETURN NEW END Posted Edited by 12Me21
  • #51 ✎ 961 Y_ack Head Admin 'sort an array, javascript style, with some lewd easter eggs DEF jsSort(A[]) DIM N$[0], E$ WHILE LEN(A) 'valentine's day edition <3 IF (A[0]||0)<3 THEN PUSH N$,STR$(POP(A)) ELSE PUSH N$,POP(A) ENDIF 'valentine's day edition OWO FOR I = LEN(N) -1 TO 1 STEP -1 IF N$[I] <= N$[I-1] THEN SWAP N$[I], N$[I-1] ELSE BREAK ENDIF NEXT WEND RETURN N$ END Posted
  • #52 ✎ 453 kenchic First Year My account is over 1 year old Website Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength osu! Is Awesome! I love osu! Express Yourself 'please dont use 0.00199 DEF NORT(INP[]) DIM RET[LEN(INP)],RES,W,V FILL RET,0.00199 FOR I=0 TO LEN(INP)-1 RES=0 W=INP[I] FOR _I=0 TO LEN(INP)-1 V=INP[_I] INC RES,ABS(0.5+ABS(W-V)/(2*(W-V))*(W-V)/(W-V)) NEXT IF RET[RES]==INP[I] THEN REPEAT INC RES UNTIL RET[RES] != INP[I] ENDIF RET[RES]=INP[I] NEXT RETURN RET END Posted
1 2 3