Computer Science Canada moving two different for loops at the same time |
Author: | zaara.syeda [ Thu Oct 26, 2006 7:09 pm ] |
Post subject: | moving two different for loops at the same time |
hii can someone plleeaasee help me. i need to know how i can move two different moving objects that are in different loops at the same time. |
Author: | Tony [ Thu Oct 26, 2006 8:12 pm ] |
Post subject: | |
they are most likely supposed to be in the same loop. You have to be more specific though. |
Author: | Ultrahex [ Thu Oct 26, 2006 8:59 pm ] |
Post subject: | |
He Basically Just Asked How To Thread 2 Things, But Thats Not a good way to do it, You should be able to take the two loops and combine them into 1 for loop into 1 for loop inside another into 2 loops one after eachother Just a Thought, some code might also help if you are trying to combine something inpeticular. |
Author: | Tony [ Thu Oct 26, 2006 9:20 pm ] | ||
Post subject: | |||
Turing is meant for procedural programming (with some optional OOP support). Definetely not for concurent processes (although they are cruedly available)
there should be no need for concurency, since Turing doesn't recognize hyperthreading or multi-core hardware ![]() |
Author: | R.G. [ Fri Oct 27, 2006 5:57 am ] |
Post subject: | |
hey! ya she most likely means how do u use the process command if im not mistaken ![]() |
Author: | zaara.syeda [ Fri Oct 27, 2006 7:47 am ] |
Post subject: | |
no but what if their distances for the loops are different? how can u put them in the same loop. |
Author: | Tony [ Fri Oct 27, 2006 8:13 am ] | ||
Post subject: | |||
events with if statements.. and math a loop is just a driver to push your code. You don't need two engines in your car to drive.
|
Author: | R.G. [ Fri Oct 27, 2006 4:56 pm ] |
Post subject: | |
ohh wow i get itt...thanks a lot! I hope zaara does too |
Author: | zaara.syeda [ Mon Oct 30, 2006 5:45 pm ] |
Post subject: | |
uumm... i dont get it ![]() heres what i have so far... process music play("4ccggaa2g4ffeeddbggffeedbbggaa2g4ffeedd2c") end music %background for x : 0 .. 400 drawbox (0, x, 640, x, 7) end for %stars for x : 0 .. 15 drawstar (50 + x, 300 + x, 80 - x, 330 - x, 14) drawstar (480 + x, 320 + x, 510 - x, 350 - x, 14) drawstar (50 + x, 200 + x, 80 - x, 230 - x, 14) drawstar (450 + x, 150 + x, 480 - x, 180 - x, 14) drawstar (600 + x, 40 + x, 630 - x, 70 - x, 14) drawstar (200 + x, 150 + x, 230 - x, 180 - x, 14) drawstar (180 + x, 50 + x, 210 - x, 80 - x, 14) end for %box around rules drawline (190, 320, 460, 320, 64) drawline(190,320,190,390,11) drawline(460,320,460,390,11) drawline(190,390,460,390,64) %moon for x : 0 .. 50 drawoval (580, 320, x, 50, 30) end for %Rings for x : 0 .. 60 drawoval (500, 100, x, 20, 43) drawoval (100, 150, x, 30, 12) drawoval (100, 50, x, 30, 108) drawoval (300, 150, x, 30, 104) drawoval (300, 50, x, 30, 120) end for %center eraser for rings for x : 0 .. 40 drawoval (500, 100, x, 40, 42) drawoval (100, 150, x, 20, 7) drawoval (100, 50, x, 20, 7) drawoval (300, 150, x, 20, 7) drawoval (300, 50, x, 20, 7) end for %words var fontID, height, ascent, descent, internalLeading : int var externalLeading : int fontID := Font.New ("Ravie:50:bold") Font.Sizes (fontID, height, ascent, descent, internalLeading) externalLeading := height - ascent - descent Font.Draw ("Rules", 200, 330, fontID, 60) Font.Free (fontID) fontID := Font.New ("Lucida Handwriting:15") Font.Draw ("5 points", 60, 150, fontID, 10) Font.Draw ("10 points", 60, 50, fontID, 95) Font.Draw ("50 points", 260, 150, fontID, 75) Font.Draw ("100 points", 260, 50, fontID, 63) Font.Draw ("Loose a Life", 440, 30, fontID, 41) fontID := Font.New ("Forte:15") Font.Draw ("Make the ball go through the rings to get points.", 100, 280, fontID, 100) Font.Draw ("Keep it away from the planets so you dont loose a life.", 80, 250, fontID, 92) Font.Draw ("After you loose three lives the game is over!", 120, 220, fontID, 77) Font.Free (fontID) fork music delay(2000) cls setscreen("graphics") View.Set ("offscreenonly") for x : 0 .. 400 drawbox (0, x, 640, x, 225) end for for x:0..10 drawbox(500,1,500+x,400,0) end for fontID := Font.New ("Forte:25") Font.Draw ("Lives", 540,370, fontID,0) Font.Draw("Score",540,270,fontID,0) Font.Free (fontID) for x:0..15 drawoval(530,330,x,15,100) drawoval(570,330,x,15,100) drawoval(610,330,x,15,100) end for for x:0..20 drawoval(320,350,x,20,100) end for for x:0..430 drawfilloval(320,x,61,31,225) drawfilloval(320, x,60,30,12) drawfilloval(320,x,40,10,225) View.Update delay(10) end for fontID := Font.New ("Forte:50") Font.Draw("5",550,200,fontID,0) Font.Free(fontID) process two for x:0..200 drawfilloval(320-x,350,21,21,225) drawfilloval(320-x,350,20,20,100) View.Update delay(10) end for for x:0..50 drawbox(550,200,550+x,250,225) end for end two process three for x:0..450 drawfilloval(120,x,61,31,225) drawfilloval(120,x,60,30,108) drawfilloval(120,x,40,10,225) View.Update delay(10) end for fontID := Font.New ("Forte:50") Font.Draw("15",550,200,fontID,0) Font.Free(fontID) end three fork two fork three |
Author: | Tony [ Mon Oct 30, 2006 7:04 pm ] |
Post subject: | |
zaara.syeda wrote: ok anyways i figured that out using process
No, you haven't... because Quote: process two for x:0..200 ... View.Update delay(10) end for ... end two I'm sorry, but you clearly have no idea what you're doing. Please refrain from using processes, you'll just complicate things for yourself. |
Author: | razrdude [ Mon Oct 30, 2006 7:57 pm ] |
Post subject: | |
Hey look at the second page of Turing tutorials, ull catch it in the name, why not to use processes and how to fix it. |
Author: | zaara.syeda [ Mon Oct 30, 2006 8:38 pm ] |
Post subject: | |
quote]I'm sorry, but you clearly have no idea what you're doing. Please refrain from using processes, you'll just complicate things for yourself[/quote] aww is it that bad??? whats wrong with the way i did it? |
Author: | razrdude [ Mon Oct 30, 2006 8:44 pm ] |
Post subject: | |
read his post: processes |
Author: | zaara.syeda [ Mon Oct 30, 2006 8:50 pm ] |
Post subject: | |
ya... but i dont get whats wrong with it |