Computer Science Canada

this is my turtle class,you can do alot with it try it out

Author:  kit-kat-kid [ Wed May 05, 2004 5:38 pm ]
Post subject:  this is my turtle class,you can do alot with it try it out

code:
%File "turtleCl.tu" the Turtle Object
unit
class TurtleCl
    export SetColour, SetPosition, SetAngle, TurnRight, TurnLeft, Move,
        ShowTrace, HideTrace
    var x := maxx div 2
    var y := maxy div 2
    var angle := 90
    var clr := black
    var showing : boolean := true
    proc SetColour (newClr : int)
        clr := newClr
    end SetColour
    proc SetPosition (newX, newY : int)
        x := newX
        y := newY
    end SetPosition
    proc SetAngle (newAngle : int)
        angle := newAngle
    end SetAngle
    proc TurnRight (turnAngle : int)
        angle -= turnAngle
        angle := angle mod 360
    end TurnRight
    proc TurnLeft (turnAngle : int)
        angle += turnAngle
        angle := angle mod 360
    end TurnLeft
    proc ShowTrace
        showing := true
    end ShowTrace
    proc HideTrace
        showing := false
    end HideTrace
    proc Move (distance : int)
        var newX, newY : int
        newX := round (x + cosd (angle) * distance)
        newY := round (y + sind (angle) * distance)
        if showing then
            Draw.Line (x, y, newX, newY, clr)
        end if
        x := newX
        y := newY
    end Move
end TurtleCl

Author:  MyPistolsIn3D [ Sat May 15, 2004 1:24 pm ]
Post subject: 

Who are you kit-kat-kid?

Author:  kit-kat-kid [ Wed May 26, 2004 7:48 pm ]
Post subject: 

who am i why do you wanna know that?

Author:  Mazer [ Wed May 26, 2004 8:48 pm ]
Post subject: 

Does anyone want to guess what the Posted Image, might have been reduced in size. Click Image to view fullscreen. button does?

Don't make me lock this topic.

Author:  beard0 [ Fri May 28, 2004 8:53 am ]
Post subject: 

I've got my version that I like, because It keeps a value for the turtle's location, and direction as a real number, then rounds it when drawing, so that multiple complex manouvers still end up where they should:

code:

unit
module Turtle

    export Go, ChangeDirection, SetDirection, SetColor, Trace, SetPosition
    var tx, ty, td : real := 0
    var tc : int := 1
    var tdwn : boolean := true

    proc Go (d : real)
        var ox, oy : real
        ox := tx
        oy := ty
        tx -= sind (td) * d
        ty += cosd (td) * d
        if tdwn then
            drawline (round (ox), round (oy), round (tx), round (ty), tc)
        end if
    end Go

    proc ChangeDirection (d : real)
        td += d
    end ChangeDirection

    proc SetDirection (d : real)
        td := d
    end SetDirection

    proc SetColor (c : int)
        tc := c
    end SetColor

    proc Trace (trc : boolean)
        tdwn := trc
    end Trace

    proc SetPosition (x, y : int)
        tx := x
        ty := y
    end SetPosition

end Turtle

Author:  poly [ Fri May 28, 2004 9:43 am ]
Post subject: 

Mazer wrote:
Does anyone want to guess what the Posted Image, might have been reduced in size. Click Image to view fullscreen. button does?

Don't make me lock this topic.

Mazer, this kid is from my computer science class. THIS IS NOT HIS OWN WORK! Our teacher wrote this and gave it to us as an example, Please do NOT give him credit for this!

Author:  zylum [ Fri May 28, 2004 3:46 pm ]
Post subject: 

poly wrote:
Mazer wrote:
Does anyone want to guess what the Posted Image, might have been reduced in size. Click Image to view fullscreen. button does?

Don't make me lock this topic.

Mazer, this kid is from my computer science class. THIS IS NOT HIS OWN WORK! Our teacher wrote this and gave it to us as an example, Please do NOT give him credit for this!


lmao, your school must be a bunch of plagerisers Twisted Evil j/k.. your teacher didnt even write that... i have a textbook from school that has the exact same class in it lol...

Author:  Paul [ Fri May 28, 2004 8:44 pm ]
Post subject: 

wow Shocked and my teacher worries about us copying stuff from compsci.ca lol.

Author:  poly [ Sat May 29, 2004 4:25 pm ]
Post subject: 

zylum wrote:
poly wrote:
Mazer wrote:
Does anyone want to guess what the Posted Image, might have been reduced in size. Click Image to view fullscreen. button does?

Don't make me lock this topic.

Mazer, this kid is from my computer science class. THIS IS NOT HIS OWN WORK! Our teacher wrote this and gave it to us as an example, Please do NOT give him credit for this!


lmao, your school must be a bunch of plagerisers Twisted Evil j/k.. your teacher didnt even write that... i have a textbook from school that has the exact same class in it lol...
well sorry if it sounded like i said the teacher wrote it, i meant he wrote it out to us to use etc, guess i was in a rush to post...but still a lot of kids in my class are copying shit from this site

Author:  Dan [ Sat May 29, 2004 4:28 pm ]
Post subject: 

So tell your teacher to come and look at the site, a quick uses of the search buttion could cheatch any cheaters.

I whould be glad to help them catch cheats espleay when they cheat on there ISU/FP project.

Author:  bugzpodder [ Sat May 29, 2004 5:46 pm ]
Post subject: 

a sorta off-topic note, my FP is basically a turtle with LOGO language telling it what to do. you can load Demos to see stuff.

Author:  Kamikagushi [ Thu Jun 10, 2004 7:00 pm ]
Post subject: 

~a question~why can't i run it~it returns as error as cannot have unit as main program~

Author:  marijuana [ Thu Jun 10, 2004 11:16 pm ]
Post subject: 

convert the escape function with sprites of terminal use. ASCII will help alot for this.

Author:  this_guy [ Wed Jul 07, 2004 7:53 pm ]
Post subject: 

do what to what?


i dunno if my version is crap or something, but unit is shown in blue (for variables)

Author:  RaPsCaLLioN [ Fri Aug 20, 2004 8:59 am ]
Post subject: 

I'm a turtle.
Errr.. I mean.. How do I use this thing. Any examples?

Author:  chunginator [ Mon Nov 15, 2004 11:11 am ]
Post subject: 

aw man!!!! noobs!!! just look in help files or search it on this site. theres a lot of help these guys can give you. they've covered this subject oh lets see.... too many freakin times to count. man i dont know how these ppl have this much patience with you guys .... btw all u plagerizers are just a bunch of idiots. and fags

Author:  RaPsCaLLioN [ Mon Nov 22, 2004 9:35 pm ]
Post subject: 

That was a little harsh. I see no explanation within this topic. So I asked for an explanation.

Nice 14 posts btw...


: