Jump to content
IGNORED

a simple basic question


Recommended Posts

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.

 

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 T
NOTE: Initializing BARREL$ as the graphic characters (between quotes) can avoid the use of the FOR A loop at the start.
  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...