
-----------------------------------
yodu123
Sat Mar 21, 2009 9:34 am

graph on turing?
-----------------------------------
does anyone has any idea how i could draw graph using Turing?

-----------------------------------
BigBear
Sat Mar 21, 2009 9:43 am

Re: graph on turing?
-----------------------------------
Do you mean cartesian plane or a bar graph or pie graph or something similiar.

The turing run window is treated like Quadrant I when using pixels to locate so the bottom left hand corner is (0,0) and the top right can be defined by (maxx, maxy) the maximum x value and the maximum y. Though this usually is just off the screen.

As for a bar graph you could get information from the user find the largest one they entered then drawfillbox a few rectangles the size porpotional to the others.

-----------------------------------
saltpro15
Sat Mar 21, 2009 11:00 am

RE:graph on turing?
-----------------------------------
Depends, bar graph would be easy, pie graph somewhat challenging and cartesian pretty difficult

please be more specific in order for us to better help you

-----------------------------------
Insectoid
Sat Mar 21, 2009 11:02 am

RE:graph on turing?
-----------------------------------
a simple line graph, lixe y = mx+b, or y = a^2+b^2 + c is easy. Just use a for loop with X in the X spot.

[code]
var m : int := 1
var b : int := 15
for x: 0..639
    Draw.Dot (x, m*x+b, black)
end for

%alternatively,

Draw.Line (x, m*x+b, x+1, m*(x+1)+b, black)
[/code]
