Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Azrak

macrumors newbie
Original poster
Apr 2, 2013
11
0
Keep an array of previously picked numbers and make sure the new number isn't on the list. Or do what I suggested and actually shuffle the cards. These may not be possible or unnecessarily difficult on account of the fact you've chosen Scratch.

Well Scratch is a very easy thing to use to people who don't have much experience, like me.

AtariMac, since you're familiar with Scratch, do you know if it is possible to use an array? Or an alternative way to do what i need?
 

Azrak

macrumors newbie
Original poster
Apr 2, 2013
11
0
Nevermind! an array on Scratch is called a list.
 
Last edited:

Azrak

macrumors newbie
Original poster
Apr 2, 2013
11
0
I create a list (or array) called "unique".
Every time the program asks me a question, i insert the question number into the list "unique".
How can i set my variable "random" to pick a number between 1 and 18 that isn't in the list "unique"? I tried:
set random [pick a number between 1 and 18] - unique.
But that didn't work.

AtariMac, think you can help?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
Alternative strategy:

Keep a list of unasked questions. Call it 'unasked'.

Keep a list of asked questions. Call it 'asked'. It starts out empty.

Pick a random number for however many questions remain in 'unasked'. Ask that question. Remove it from 'unasked', and add it to 'asked'.

Repeat until 'unasked' is empty, then start over.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
Alternative strategy:

Keep a list of unasked questions. Call it 'unasked'.

Keep a list of asked questions. Call it 'asked'. It starts out empty.

Pick a random number for however many questions remain in 'unasked'. Ask that question. Remove it from 'unasked', and add it to 'asked'.

Repeat until 'unasked' is empty, then start over.

What's the point of 'asked'?
 

AtariMac

macrumors regular
Mar 10, 2004
191
89
Southeastern, PA
I create a list (or array) called "unique".
Every time the program asks me a question, i insert the question number into the list "unique".
How can i set my variable "random" to pick a number between 1 and 18 that isn't in the list "unique"? I tried:
set random [pick a number between 1 and 18] - unique.
But that didn't work.

AtariMac, think you can help?

Try something like this attached image:
 

Attachments

  • random.jpg
    random.jpg
    74.9 KB · Views: 99

Hans Kamp

macrumors member
Mar 24, 2013
38
0
Enschede, Netherlands
AtariMac,

It looks like a programming language, only the appearance is awesome graphically, IMO. It would be a very little step to translate this into Xcode or another structured programming language.

As shown here, you can use a flag which is NO when a question has not been asked yet, and YES when it has.
 

AtariMac

macrumors regular
Mar 10, 2004
191
89
Southeastern, PA
AtariMac,

It looks like a programming language, only the appearance is awesome graphically, IMO. It would be a very little step to translate this into Xcode or another structured programming language.

As shown here, you can use a flag which is NO when a question has not been asked yet, and YES when it has.

I really like Scratch and the Berkeley variant SNAP! I realize that it is not for everyone, but it reminds me of the early days of personal computing when BASIC was included with every machine.

In fact, Scratch's syntax is very similar to BASIC. It is object oriented though, so each sprite or background can run independently or together. It is great for making 2D games as it has support for players, missiles, and collision detection.

For anyone that wants the satisfaction of making a computer do what you want rather than just doing what someone else wants the computer to do Scratch is a great gateway.
 

Hans Kamp

macrumors member
Mar 24, 2013
38
0
Enschede, Netherlands
I may want to learn it. I have something with languages, whether they are programming languages like C or Xcode, natural languages like German or Afrikaans or artificial langages like Esperanto or Interlingua... :)
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
programming languages like c or xcode

¡¡¡XCODE is NOT a PROGRAMMING LANGUAGE!!!​


Xcode is an Integrated Development Environment (IDE). It bundles together several components for doing various programming related tasks. It includes tools for doing research, linking libraries, writing code, compiling code, debugging code, running code, making executables, signing executables, and uploading executables to Apple.

It supports many languages for its code related tasks, including C, Obj-C, C++, Obj-C++, and JS.

Trying to say that Xcode is a language is like saying that paper and pencil is a language, or that TextEdit, Word, Pages, or any other text editor is a language. It is not a language! It is a tool that helps you do any number of programming tasks in any number of programming languages. It is not itself a programming language.

I'll say it one more time (just because copy and paste is so easy,):

¡¡¡XCODE is NOT a PROGRAMMING LANGUAGE!!!​
 

JordenLouis

macrumors newbie
May 23, 2013
1
0
Quiz

I had to say I got something really meaningful here which I was searching for so long. Thanks buddy for bringing this out here.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.