Jump to content
IGNORED

Deal or No Deal Game


Recommended Posts

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.

Link to comment
Share on other sites

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 by jaybird3rd
  • Like 2
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...