xdslx Posted June 16, 2017 Share Posted June 16, 2017 I met a basic program on youtube , I wanted to make it run 8 times consecutively. I tried it with for next , but I couldnt do it . here is the link of the video of the short basic program. what I want is the program run 8 times and stop. seems simple but I could not. 1 Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted June 16, 2017 Share Posted June 16, 2017 135 FOR T = 1 TO 8 280 PRINT 290 NEXT T 2 Quote Link to comment Share on other sites More sharing options...
xdslx Posted June 16, 2017 Author Share Posted June 16, 2017 I put the FOR to line 125 , because I wanted the whole process repeat , and put the next to 290 in that situation it gave an error which I fixed by adding a CLR before 130 , but that killed the "for next " . that shows you are good at this , thank you very much Quote Link to comment Share on other sites More sharing options...
Rybags Posted June 17, 2017 Share Posted June 17, 2017 Seems weird to me why you'd bother to have a "barrel" then move remaining numbers down a slot and reduce the possible random number as the method to not have multiple picks of one number in a game. It'd be easier to just use the array as 0/1 flags as to whether a # has been picked yet which would allow a bunch of the code to be ditched. There would be insignificant slowdown when an already occupied number was picked, on average it should only occur only every few games. Quote Link to comment Share on other sites More sharing options...
xdslx Posted June 17, 2017 Author Share Posted June 17, 2017 This makes it closer to the real thing , a kind of simulation . In real lotto , there is no chance a number to be picked again and say oh this was picked lets pick another. So this code is closer to the real thing. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted June 17, 2017 Share Posted June 17, 2017 Should be quicker using a string. Using a length of 36 avoids the IF-THEN condition, as the number at the end is irrelevant when it can't be chosen in subsequent picks. 130 DIM BARREL$(36) 135 FOR T=1 TO 8 140 FOR A=1 TO 36 150 BARREL$(A)=CHR$(A) 160 NEXT A 180 FOR N=7 TO 1 STEP -1 200 A=INT(RND(0)*(35+N-7)+1) 210 ? ASC(BARREL$(A));" "; 230 BARREL$(A)=BARREL$(A+1) 270 NEXT N 280 ? 290 NEXT TNOTE: Initializing BARREL$ as the graphic characters (between quotes) can avoid the use of the FOR A loop at the start. 1 Quote Link to comment Share on other sites More sharing options...
2600problems Posted June 19, 2017 Share Posted June 19, 2017 (edited) what's her name, does she have kids. XD i'm kidding Edited June 19, 2017 by 2600problems Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.