🅱️ode 🅱️ritique
You should use the yFib library.
use "PRG1:yfib.lib" as yfib for n = 0 to max_int(): yfib.fib(n) next
im surprised i have to say this but improved is in quotes because it's supposed to be a bad improve“In this thread: post code that you would like other users to ‘improve.’”Are you forgetting the point of this threadi want to critique (or 🅱️ritique i guess) an entire game, but that would probably be too much code to retype.I don’t think I’d trust you with correcting much of my code...
hi folks,
my keygen is almost done, but it needs some music. Can I get some help?
KEYGEN.PRG
GOSUB @LOGO VAR _VeD3j$,_30ztZ$,_6H44t$ _VeD3j$= "ROOT" 'your code goes here WHILE LEN(_VeD3j$) 'or here _30ztZ$=CHR$(65+RND(27))+CHR$(65+RND(27))+CHR$(65+RND(27))+CHR$(65+RND(27))+CHR$(65+RND(27))+CHR$(65+RND(27))+CHR$(65+RND(27)) F=CSRY LOCATE 0,29?"."*((MAINCNT/30)MOD 4)+" "; LOCATE 6,29?"["+_30ztZ$+"]"; LOCATE 0,F GOSUB @0EDF IF(_VeD3j$=="ROOT" AND _6H44t$=="GTD3H3RVNN54J3N7B5HLVLPG7S5PQBGN")THEN ?"Key found: "+_30ztZ$ BEEP 3_VeD3j$="" ENDIF WEND END @LOGO COLOR 3?" ";:COLOR 14?" /∴ヘ" COLOR 3?" ()";:COLOR 14?" イ`ーノ" COLOR 3?" ノ。、";:COLOR 14?"|/ ∀ レ L|" COLOR 3?" _ノ ";:COLOR 14?" ノ" COLOR 3?" (),イ()";:COLOR 14?"人 J ";:COLOR 9?"/´`" COLOR 3?" 。ハ〈";:COLOR 14?"`壬rュ";:COLOR 9?"〃´`レ" COLOR 3?",ノ`z";:COLOR 14?";:_イ>}{<>、";:COLOR 9?"'´Ξ`" COLOR 3?" ()>--/";:COLOR 14?"<ノ>";:COLOR 9?"_`>." COLOR 3?" ノ。ア-一´";:COLOR 14?" ";:COLOR 9?"`>´ァ" COLOR 3?" 」_ノ";:COLOR 14?" `¨TT¨´ ";:COLOR 9?"/" COLOR 15?" NueGen ver. 0.2" RETURN 'ignore this @0EDF _IsCp7$=""_5ylP8=32_d3O4q=35743_epp34=1009_jo09u=929 _iYKlH=503_Cv2XP=0_hc3m0=0_CmZH9=0_ti3IW=0_hc3m0=0 @0F76 IF(_hc3m0>LEN(_30ztZ$)-1)THEN GOTO@1044 _ti3IW=_ti3IW+ASC(MID$(_30ztZ$,_hc3m0,1))*(_hc3m0+1) _hc3m0=_hc3m0+1GOTO@0F76@1044@1053 IF!(LEN(_30ztZ$)<_5ylP8)THEN GOTO@1124 _d3O4q=(_d3O4q*_epp34+_jo09u)MOD _iYKlH __IsCp7$=CHR$((_d3O4q*LEN(_30ztZ$)*_ti3IW+3)MOD 16) _30ztZ$=_30ztZ$+__IsCp7$GOTO@1053@1124 _hc3m0=0@113C IF(_hc3m0>LEN(_30ztZ$)-1)THEN GOTO@14FA _Cv2XP=1_CmZH9=0@11C3 IF(_CmZH9>LEN(_30ztZ$)-1)THEN GOTO@1424 IF!(_CmZH9!=_hc3m0)THEN GOTO@12FE _d3O4q=(_d3O4q*_epp34+_jo09u)MOD _iYKlH __IsCp7$=MID$(_30ztZ$,_CmZH9,1) _Cv2XP=(_Cv2XP*ASC(__IsCp7$)*_d3O4q+_CmZH9)MOD _5ylP8 GOTO@130D@12FE@130D IF!(_CmZH9==_hc3m0)THEN GOTO@13E2 __IsCp7$=MID$(_30ztZ$,_CmZH9,1) _d3O4q=(_d3O4q*_epp34+_jo09u)MOD _iYKlH _Cv2XP=(_Cv2XP*ASC(__IsCp7$)*_d3O4q+_CmZH9)MOD _5ylP8 GOTO@13F1@13E2@13F1 _CmZH9=_CmZH9+1:GOTO@11C3@1424 IF!(_Cv2XP<10)THEN GOTO@1487 _Cv2XP=_Cv2XP+48GOTO@14AA@1487 _Cv2XP=_Cv2XP+65-10@14AA _6H44t$=_6H44t$+CHR$(_Cv2XP) _hc3m0=_hc3m0+1GOTO@113C @14FA RETURN@1510 RETURN
Ok, now that I see what you mean I admit that was pretty ignorant of me.im surprised i have to say this but improved is in quotes because it's supposed to be a bad improve“In this thread: post code that you would like other users to ‘improve.’”Are you forgetting the point of this threadi want to critique (or 🅱️ritique i guess) an entire game, but that would probably be too much code to retype.I don’t think I’d trust you with correcting much of my code...
Random number oscillator. It should return N, 0 or -N. This is the best I got without using IFs:Non-joke code critique (aka Not Getting The Joke):VAR N=5 RETURN N*((-1*(RND(2)==1))+(1*(RND(2)==1)))
RETURN N*(RND(3)-1)Your version has a 2/4 chance of it being 0. My version has an equal 1/3 chance of either of the 3 options happening.
DEF RNO(N) RANDOMIZE 0,420+RND(10) RETURN N*(RND(3)-1) ENDrandomizes the rng seed for extra randomness. Tested on 3.5.2.
explanation (run before reading)
RNG seed abuse, obviously. By default the sequence given by RND() is "random" With a seed, the random number generator can be made to produce the same sequence every time. This code, at least in 3.5.2, uses a series of seed values starting at 420 that all produce "2" for the first value. Since the function will always 're-initialize' the rng every time it is called, it's like asking for that first number every time.That's not random enough:DEF RNO(N) RANDOMIZE 0,420+RND(10) RETURN N*(RND(3)-1) ENDrandomizes the rng seed for extra randomness. Tested on 3.5.2.
DEF RNO2(N) VAR CHANNEL=RND(8) RANDOMIZE CHANNEL,420+RND(10) RETURN N*(RND(CHANNEL,3)-1) ENDAnother good randomizer:
RANDOMIZE 0 DEF RNO3(N) RANDOMIZE 0,RND(1000) RETURN N*(RND(3)-1) END
How about a random string generator?That's not random enough:DEF RNO(N) RANDOMIZE 0,420+RND(10) RETURN N*(RND(3)-1) ENDrandomizes the rng seed for extra randomness. Tested on 3.5.2.DEF RNO2(N) VAR CHANNEL=RND(8) RANDOMIZE CHANNEL,420+RND(10) RETURN N*(RND(CHANNEL,3)-1) ENDAnother good randomizer:RANDOMIZE 0 DEF RNO3(N) RANDOMIZE 0,RND(1000) RETURN N*(RND(3)-1) END