Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help me with turing!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
civicstar




PostPosted: Fri Mar 11, 2005 10:59 am   Post subject: help me with turing!!!

k we r learning turing in class and i have an assignment due and i dont even know where to start..so if anyone who uis farmiliar with this program could u plz help me out

heres the question:

Using you "looping structures" and out new "locate" function, attempt to create an animation "face". Your face will alternate between "happy", and a "sad" face.
(Hint : use "loops", delays, and cls(clear screen))

thx! Laughing
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Mar 11, 2005 11:56 am   Post subject: (No subject)

Turing:

var i : int := 0
loop
    i += 1
    locate (round (maxrow / 2), round (maxcol / 2))
    put "=" + chr (40 + i mod 2)
    delay (500)
end loop

browse our tutorials to learn about loops. use of locate() can be found in Turing's help files F10
Mazer




PostPosted: Fri Mar 11, 2005 1:21 pm   Post subject: (No subject)

1) Should be more specific in subject.
2) Should be in Turing Help.
3) Moved.
ssr




PostPosted: Fri Mar 11, 2005 8:51 pm   Post subject: (No subject)

code:
loop
locate (1,1)
put "= ("
delay (500)
locate (1,1)
put "= )"
delay (500)
end loop

lol Laughing
MysticVegeta




PostPosted: Fri Mar 11, 2005 9:58 pm   Post subject: (No subject)

code:
var lol : boolean := true
var expression : string
loop
    if lol then
        expression:= chr (41)
        lol := false
    else
        expression:= chr (47)
        lol := true
    end if
    locate (round (maxrow / 2), round (maxcol / 2))
    put "=", expression
    delay (1000)
end loop


my type lol
illu45




PostPosted: Sat Mar 12, 2005 7:00 pm   Post subject: (No subject)

tony wrote:
Turing:

var i : int := 0
loop
    i += 1
    locate (round (maxrow / 2), round (maxcol / 2))
    put "=" + chr (40 + i mod 2)
    delay (500)
end loop

browse our tutorials to learn about loops. use of locate() can be found in Turing's help files F10


Lol, that's great.

Here's my slighlty more deltailed happy face... No locate statements, though...
code:

var i : int := 0
loop
    if i = 0 then
        delay (1000)
        cls
        drawoval (320, 200, 100, 100, 1)
        drawoval (275, 230, 20, 20, 1)
        drawoval (360, 230, 20, 20, 1)
        drawline (320, 200, 320, 170, 1)
        drawarc (320, 150, 50, 25, 180, 0, 1)
        i := 1
    elsif i = 1 then
        delay (1000)
        cls
        drawoval (320, 200, 100, 100, 1)
        drawoval (275, 230, 20, 20, 1)
        drawoval (360, 230, 20, 20, 1)
        drawline (320, 200, 320, 170, 1)
        drawarc (320, 125, 50, 25, 0, 180, 1)
        i := 0
    end if
end loop
Token




PostPosted: Sat Mar 12, 2005 8:48 pm   Post subject: (No subject)

Heh, ssr i was thinking the exact same thing Laughing
and Illu45, i fixed up ur code to include 3 locate statements Wink

code:

var i : int := 0
locate (1, 30)
put "This is illu45's face"

loop
    if i = 0 then
        delay (1000)
        cls
        locate (1, 30)
        put "This is illu45's face"
        drawoval (320, 200, 100, 100, 1)
        drawoval (275, 230, 20, 20, 1)
        drawoval (360, 230, 20, 20, 1)
        drawline (320, 200, 320, 170, 1)
        drawarc (320, 150, 50, 25, 180, 0, 1)
        i := 1
    elsif i = 1 then
        delay (1000)
        cls
        locate (1, 30)
        put "This is illu45's face"
        drawoval (320, 200, 100, 100, 1)
        drawoval (275, 230, 20, 20, 1)
        drawoval (360, 230, 20, 20, 1)
        drawline (320, 200, 320, 170, 1)
        drawarc (320, 125, 50, 25, 0, 180, 1)
        i := 0
    end if
end loop
ssr




PostPosted: Sat Mar 12, 2005 9:20 pm   Post subject: (No subject)

code:
View.Set ("offscreenonly")
proc face
    drawfilloval (320, 200, 100, 100, yellow)
    drawfilloval (275, 230, 20, 20, blue)
    drawfilloval (360, 230, 20, 20, blue)
    drawline (320, 210, 320, 190, 1)
end face
loop
    for decreasing i : 25 .. 1
        face
        drawarc (320, 150, 50, i, 0, 180, brightred)
        delay (100)
        View.Update
        cls
    end for
    for i : 1 .. 25
        face
        drawarc (320, 150, 50, i, 180, 0, brightred)
        delay (100)
        View.Update
        cls
    end for
    for decreasing i : 25 .. 1
        face
        drawarc (320, 150, 50, i, 180, 0, brightred)
        delay (100)
        View.Update
        cls
    end for
    for i : 1 .. 25
        face
        drawarc (320, 150, 50, i, 0, 180, brightred)
        delay (100)
        View.Update
        cls
    end for
end loop

Another face Very Happy Sad 8)
Sponsor
Sponsor
Sponsor
sponsor
illu45




PostPosted: Sat Mar 12, 2005 9:34 pm   Post subject: (No subject)

Here's another face, with wrinkles and tears... Still no locate statements.. I really see no need for them in a program like this one.

code:

var i : int := 0
var r2, r1 : int

loop
for decreasing z : 40 .. 0 by 5
    r2 := z
    drawoval (320, 200, 125, 125, 1)
    drawoval (275, 230, 20, 20, 1)
    drawoval (360, 230, 20, 20, 1)
    drawline (320, 200, 320, 170, 1)
    drawarc (320, 130, 50, r2, 180, 0, 1)
    if z >= 35 then
        drawline (225, 250, 260, 250, 1)
        drawline (225, 210, 260, 210, 1)
        drawline (250, 230, 210, 230, 1)
        drawline (210, 230, 205, 240, 1)
        drawline (375, 250, 400, 250, 1)
        drawline (375, 210, 400, 210, 1)
        drawline (385, 230, 420, 230, 1)
        drawline (420, 230, 425, 240, 1)
    elsif z >= 30 or z >= 25 then
        drawline (250, 230, 210, 230, 1)
        drawline (210, 230, 205, 240, 1)
        drawline (385, 230, 420, 230, 1)
        drawline (420, 230, 425, 240, 1)
    elsif z >= 20 or z >= 10 then
        drawline (250, 230, 210, 230, 1)
        drawline (385, 230, 420, 230, 1)
    end if
    delay (250)
    cls
end for

for x : 0 .. 30 by 5
    r1 := x
    drawoval (320, 200, 125, 125, 1)
    drawoval (275, 230, 20, 20, 1)
    drawoval (360, 230, 20, 20, 1)
    drawline (320, 200, 320, 170, 1)
    drawarc (320, 130, 50, r1, 0, 180, 1)
    if x = 5 and x < 10 then
        drawoval (375, 200, 5, 5, 1)
    elsif x = 10 and x < 15 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
    elsif x = 15 and x < 20 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
    elsif x = 20 and x < 25 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
        drawoval (290, 170, 5, 5, 1)
    elsif x >= 25 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
        drawoval (290, 170, 5, 5, 1)
        drawoval (375, 160, 5, 5, 1)
    end if
    delay (250)
    cls
end for

for decreasing x2 : 30 .. 0 by 5
    r1 := x2
    drawoval (320, 200, 125, 125, 1)
    drawoval (275, 230, 20, 20, 1)
    drawoval (360, 230, 20, 20, 1)
    drawline (320, 200, 320, 170, 1)
    drawarc (320, 130, 50, r1, 0, 180, 1)
    if x2 = 5 and x2 < 10 then
        drawoval (375, 200, 5, 5, 1)
    elsif x2 = 10 and x2 < 15 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
    elsif x2 = 15 and x2 < 20 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
    elsif x2 = 20 and x2 < 25 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
        drawoval (290, 170, 5, 5, 1)
    elsif x2 >= 25 then
        drawoval (375, 200, 5, 5, 1)
        drawoval (290, 190, 5, 5, 1)
        drawoval (375, 180, 5, 5, 1)
        drawoval (290, 170, 5, 5, 1)
        drawoval (375, 160, 5, 5, 1)
    end if
    delay (250)
    cls
end for

for z2 : 0 .. 40 by 5
    r2 := z2
    drawoval (320, 200, 125, 125, 1)
    drawoval (275, 230, 20, 20, 1)
    drawoval (360, 230, 20, 20, 1)
    drawline (320, 200, 320, 170, 1)
    drawarc (320, 130, 50, r2, 180, 0, 1)
    if z2 >= 35 then
        drawline (225, 250, 260, 250, 1)
        drawline (225, 210, 260, 210, 1)
        drawline (250, 230, 210, 230, 1)
        drawline (210, 230, 205, 240, 1)
        drawline (375, 250, 400, 250, 1)
        drawline (375, 210, 400, 210, 1)
        drawline (385, 230, 420, 230, 1)
        drawline (420, 230, 425, 240, 1)
    elsif z2 >= 30 or z2 >= 25 then
        drawline (250, 230, 210, 230, 1)
        drawline (210, 230, 205, 240, 1)
        drawline (385, 230, 420, 230, 1)
        drawline (420, 230, 425, 240, 1)
    elsif z2 >= 20 or z2 >= 10 then
        drawline (250, 230, 210, 230, 1)
        drawline (385, 230, 420, 230, 1)
    end if
    delay (250)
    cls
end for
end loop



Yes, I know its long... Gimme a break. If you can find a way to shorten it, feel free.
MysticVegeta




PostPosted: Sun Mar 20, 2005 11:48 am   Post subject: (No subject)

Wow ppl actually spent time on faces lol
ssr




PostPosted: Sun Mar 20, 2005 9:11 pm   Post subject: (No subject)

lol yes we LOVE human faces Very Happy Sad Surprised Laughing Confused Shocked Mad Razz Crying or Very sad Embarassed Sad Smile Very Happy Rolling Eyes Wink
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: