
-----------------------------------
kit-kat-kid
Wed May 05, 2004 5:38 pm

this is my turtle class,you can do alot with it try it out
-----------------------------------
%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


-----------------------------------
MyPistolsIn3D
Sat May 15, 2004 1:24 pm


-----------------------------------
Who are you kit-kat-kid?

-----------------------------------
kit-kat-kid
Wed May 26, 2004 7:48 pm


-----------------------------------
who am i why do you wanna know that?

-----------------------------------
Mazer
Wed May 26, 2004 8:48 pm


-----------------------------------
Does anyone want to guess what the http://www.compsci.ca/v2/templates/Appalachia/images/lang_english/icon_pm.gif button does?

Don't make me lock this topic.

-----------------------------------
beard0
Fri May 28, 2004 8:53 am


-----------------------------------
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:


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


-----------------------------------
poly
Fri May 28, 2004 9:43 am


-----------------------------------
Does anyone want to guess what the http://www.compsci.ca/v2/templates/Appalachia/images/lang_english/icon_pm.gif 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!

-----------------------------------
zylum
Fri May 28, 2004 3:46 pm


-----------------------------------
Does anyone want to guess what the http://www.compsci.ca/v2/templates/Appalachia/images/lang_english/icon_pm.gif 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: j/k..  your teacher didnt even write that... i have a textbook from school that has the exact same class in it lol...

-----------------------------------
Paul
Fri May 28, 2004 8:44 pm


-----------------------------------
wow  :shock:  and my teacher worries about us copying stuff from compsci.ca lol.

-----------------------------------
poly
Sat May 29, 2004 4:25 pm


-----------------------------------
Does anyone want to guess what the http://www.compsci.ca/v2/templates/Appalachia/images/lang_english/icon_pm.gif 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: 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

-----------------------------------
Dan
Sat May 29, 2004 4:28 pm


-----------------------------------
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.

-----------------------------------
bugzpodder
Sat May 29, 2004 5:46 pm


-----------------------------------
a sorta off-topic note, my [url=http://www.compsci.ca/v2/viewtopic.php?t=5002]FP is basically a turtle with LOGO language telling it what to do.  you can load Demos to see stuff.

-----------------------------------
Kamikagushi
Thu Jun 10, 2004 7:00 pm


-----------------------------------
~a question~why can't i run it~it returns as error as cannot have unit as main program~

-----------------------------------
marijuana
Thu Jun 10, 2004 11:16 pm


-----------------------------------
convert the escape function with sprites of terminal use. ASCII will help alot for this.

-----------------------------------
this_guy
Wed Jul 07, 2004 7:53 pm


-----------------------------------
do what to what?


i dunno if my version is crap or something, but unit is shown in blue (for variables)

-----------------------------------
RaPsCaLLioN
Fri Aug 20, 2004 8:59 am


-----------------------------------
I'm a turtle. 
Errr.. I mean.. How do I use this thing.  Any examples?

-----------------------------------
chunginator
Mon Nov 15, 2004 11:11 am


-----------------------------------
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

-----------------------------------
RaPsCaLLioN
Mon Nov 22, 2004 9:35 pm


-----------------------------------
That was a little harsh.  I see no explanation within this topic.  So I asked for an explanation.

Nice 14 posts btw...
