This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-10-30 12:22:32

lolzmaster
New Scratcher
Registered: 2011-10-06
Posts: 5

How to make Scratch randomly select an operation?

How can I make Scratch randomly select +,-,*,/?

Thanks for your help in advance.

Offline

 

#2 2011-10-30 12:44:40

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: How to make Scratch randomly select an operation?

The easiest way would be to do something like this:

Code:

set {temp} to (pick random 1 to 4)
if {temp} = 1
     addition operation
if {temp} = 2
     subtraction operation
if {temp} = 3
     multiplication operation
if {temp} = 4
     division operation

http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer