Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 6, 2013, 10:22 AM   #26
Azrak
Thread Starter
macrumors newbie
 
Join Date: Apr 2013
Quote:
Originally Posted by ArtOfWarfare View Post
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 is offline   0 Reply With Quote
Old Apr 6, 2013, 10:44 AM   #27
Azrak
Thread Starter
macrumors newbie
 
Join Date: Apr 2013
Nevermind! an array on Scratch is called a list.

Last edited by Azrak; Apr 6, 2013 at 10:52 AM.
Azrak is offline   0 Reply With Quote
Old Apr 6, 2013, 11:20 AM   #28
Azrak
Thread Starter
macrumors newbie
 
Join Date: Apr 2013
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?
Azrak is offline   0 Reply With Quote
Old Apr 6, 2013, 11:56 AM   #29
chown33
macrumors 603
 
Join Date: Aug 2009
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.
chown33 is offline   0 Reply With Quote
Old Apr 6, 2013, 01:10 PM   #30
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by chown33 View Post
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'?
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 6, 2013, 02:25 PM   #31
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by ArtOfWarfare View Post
What's the point of 'asked'?
To avoid rereading the file. At any point, the complete set of questions is the union of 'asked' with 'unasked'.
chown33 is offline   0 Reply With Quote
Old Apr 6, 2013, 07:30 PM   #32
ravenvii
macrumors 604
 
ravenvii's Avatar
 
Join Date: Mar 2004
Location: Melenkurion Skyweir
Yet another alternative solution:

while number in unique list:
unique = generate new random number
__________________
59 6F 75 20 73 70 6F 6F 6E 79 20 62 61 72 64 21
ravenvii is offline   0 Reply With Quote
Old Apr 6, 2013, 08:30 PM   #33
AtariMac
macrumors regular
 
Join Date: Mar 2004
Location: Southeastern, PA
Send a message via AIM to AtariMac
Quote:
Originally Posted by Azrak View Post
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:
Attached Thumbnails
Click image for larger version

Name:	random.jpg
Views:	33
Size:	74.9 KB
ID:	406602  
__________________
The world is my oyster
AtariMac is offline   0 Reply With Quote
Old Apr 7, 2013, 03:48 AM   #34
Azrak
Thread Starter
macrumors newbie
 
Join Date: Apr 2013
Quote:
Originally Posted by AtariMac View Post
Try something like this attached image:
Wow! great thinking! My quiz is finally 100% built!
Thanks a ton
Azrak is offline   1 Reply With Quote
Old Apr 7, 2013, 06:02 AM   #35
Hans Kamp
macrumors member
 
Join Date: Mar 2013
Location: 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.
Hans Kamp is offline   0 Reply With Quote
Old Apr 7, 2013, 07:25 AM   #36
AtariMac
macrumors regular
 
Join Date: Mar 2004
Location: Southeastern, PA
Send a message via AIM to AtariMac
Quote:
Originally Posted by Hans Kamp View Post
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.
__________________
The world is my oyster
AtariMac is offline   0 Reply With Quote
Old Apr 10, 2013, 12:48 AM   #37
Hans Kamp
macrumors member
 
Join Date: Mar 2013
Location: 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...
Hans Kamp is offline   0 Reply With Quote
Old Apr 10, 2013, 08:07 AM   #38
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by hans kamp View Post
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!!!
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Apr 10, 2013, 08:10 PM   #39
ravenvii
macrumors 604
 
ravenvii's Avatar
 
Join Date: Mar 2004
Location: Melenkurion Skyweir
Just to go along with the upside exclamation points:


¡¡¡XCODE NO es un LENGUAJE DE PROGRAMACION!!!
__________________
59 6F 75 20 73 70 6F 6F 6E 79 20 62 61 72 64 21
ravenvii is offline   0 Reply With Quote
Old May 23, 2013, 04:28 AM   #40
JordenLouis
macrumors newbie
 
Join Date: May 2013
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.
JordenLouis is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Help with a simple program rimmi2002 Mac Programming 0 Nov 1, 2013 03:22 PM
How to create a simple text rollover in Adobe Encore macaddict23 Digital Video 0 Feb 1, 2013 05:40 PM
Simple image editing program glen e Design and Graphics 4 Nov 27, 2012 02:55 PM
create GIF animations from video files with simple software Quotenfrau Mac Applications and Mac App Store 0 Jul 22, 2012 02:31 AM

Forum Jump

All times are GMT -5. The time now is 11:16 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC