Champions_2002 Posted May 29, 2019 Share Posted May 29, 2019 Hi I am messing about with Atari Basic and trying to make a deal of no deal game. i have the contestants names in data statements, and i have got a random routine to pick the players names 11 on the left side and 11 on the right, my first problem is how do i get basic to pick the names and that name not appear again on the list. so for instance if the basic picks Luke it should not appear again till another run of the code. Also how can i do this with numbers so each contestant has a number next to them but random 1 to 22. Quote Link to comment Share on other sites More sharing options...
thank you Posted May 29, 2019 Share Posted May 29, 2019 (edited) the simplest shuffle algorithm i know is to iterate over the list and swap with a random location. LIST 0 DIM X(22) 1 FOR I=1 TO 22:X(I)=I:NEXT I 2 FOR I=1 TO 22:N=INT(RND(0)*22)+1:B=X(N) (N)=X(I) (I)=B:NEXT I 3 FOR I=1 TO 22:? X(I);" ";:NEXT I READY RUN 17 20 14 22 7 15 13 12 11 16 6 10 4 3 18 9 8 19 21 2 1 5 READY For the first question, if you only have 22 names you can do it the same way; if there are more you'll have to iterate over already chosen names and reject duplicates. The mad faces are COLON X, hope it helps. Edited May 29, 2019 by jaybird3rd 2 Quote Link to comment Share on other sites More sharing options...
jaybird3rd Posted May 29, 2019 Share Posted May 29, 2019 The mad faces are COLON X, hope it helps.I placed your code inside a pair of code tags for you, like this ... [code]INSERT YOUR CODE HERE[/code] ... which prevents the symbols from being interpreted as emoticons. Quote Link to comment Share on other sites More sharing options...
Champions_2002 Posted May 29, 2019 Author Share Posted May 29, 2019 Thank you for you help 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.