
-----------------------------------
vertdragon23
Sat Oct 19, 2013 1:37 pm

Random Shape Drawer with menu
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?



Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using
4.1.1 (latest)

-----------------------------------
Nathan4102
Sat Oct 19, 2013 1:45 pm

RE:Random Shape Drawer with menu
-----------------------------------
We don't write your homework programs, we help out. If you give it a try, and have a specific question, feel free to ask, and we'll try to help!

-----------------------------------
Raknarg
Sat Oct 19, 2013 2:17 pm

RE:Random Shape Drawer with menu
-----------------------------------
THe first thing to do is figure out what things you need to track. What do you thing? And be very detailed. Anything that you can think of tracking, probably needs to be there

-----------------------------------
vertdragon23
Sat Oct 19, 2013 2:48 pm

RE:Random Shape Drawer with menu
-----------------------------------
This is what I have so far. Can anyone help me with procedure and how I can make it so each option is a procedure.





var op:int
put "What shape would you like?"
put " 1 for Circle, 2 for Rectangle, 3 for Star, 4 for Square or 5 for Maple Leaf"
get op
if op= 1 then elsif op=2 then
    for i : 1 .. 1000
        var r : int := Rand.Int (20, 50)
        var x : int := Rand.Int (r, maxx - r)
        var y : int := Rand.Int (r, maxy - r)
        var c : int := Rand.Int (0, maxcolor)
        Draw.FillBox (x, y, r, r, c)
        end for
        end if

    for i : 1 .. 10000
        var r : int := Rand.Int (20, 50)
        var x : int := Rand.Int (r, maxx - r)
        var y : int := Rand.Int (r, maxy - r)
        var c : int := Rand.Int (0, maxcolor)
        Draw.FillOval (x, y, r, r, c)
        delay (50)

end for



Mod Edit:
Please wrap you code in either of the following in order to preserve whitespace (indentation) and to highlight the syntax.
 ... code ... 

[code] ... code ... [/code ]
[/code]

-----------------------------------
Raknarg
Sat Oct 19, 2013 3:09 pm

RE:Random Shape Drawer with menu
-----------------------------------
Do you know how procedures work?

-----------------------------------
vertdragon23
Sat Oct 19, 2013 3:12 pm

RE:Random Shape Drawer with menu
-----------------------------------
Not really, im trying to get it so when the user enters the number listed the procedure will be called upon.

-----------------------------------
Zren
Sat Oct 19, 2013 4:01 pm

RE:Random Shape Drawer with menu
-----------------------------------
 and end loop if you want an infinite loop. Then use  to exit from it when a certain condition happens (eg if a button is pressed).

[code]if op= 1 then elsif op=2 then [/code]

You should probably read through the [url=http://compsci.ca/v3/viewtopic.php?t=14656]If statements tutorial in the Turing Walkthrough.
