Can Turing execute two procedure at the same time.
Author |
Message |
canmovie
|
Posted: Sat Oct 23, 2010 9:30 pm Post subject: Can Turing execute two procedure at the same time. |
|
|
I'm making a slot machine for school on turing, and I made three procedures, one making the first slot turn the second one making the seconds slot turn, etc. Though the problem is, I can't figure out a way to make them all turn at the same time. I have no idea how to start both procedures at the same time. Is it possible to do that in Turing? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dan
|
Posted: Sat Oct 23, 2010 10:02 pm Post subject: RE:Can Turing execute two procedure at the same time. |
|
|
Their is a way to simulate this behavior in turing. However in your case it's not the best soultion to the problem.
Rather then trying to run them at the same time the logic of your program should be more like this (note the following is pseudocode):
code: |
Set graphics mode to offscreen
......
loop
cls
.......
run first procedure
run second procedure
run thrid procedure
........
view.update()
end loop
.......
|
In this case each procedure would draw the next frame of the slot wheel. The screen is only update when view.update() is called, so to the user it looks like it happened at the same time.
Take a look at:
http://compsci.ca/holtsoft/doc/view_update.html
http://compsci.ca/holtsoft/doc/view_set.html
You want the offscreenonly mode, so you can manauly update the screen with View.Update() |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
CWRules
|
Posted: Sat Oct 23, 2010 10:31 pm Post subject: Re: Can Turing execute two procedure at the same time. |
|
|
Dan's right, his suggestion is the best way. But running multiple procedures at once has its uses. Look up processes and the fork command. |
|
|
|
|
|
DanShadow
|
Posted: Sat Oct 23, 2010 10:33 pm Post subject: RE:Can Turing execute two procedure at the same time. |
|
|
Given the type of assignment you have, its not necessary to run multiple procedures at the same time.
However, im pretty sure you can do "true" simutaneous procedural executions on multi-CPU systems, but typically just making your procedure calls one after another will be sufficient. |
|
|
|
|
|
Dan
|
Posted: Sat Oct 23, 2010 10:45 pm Post subject: Re: RE:Can Turing execute two procedure at the same time. |
|
|
DanShadow @ 23rd October 2010, 10:33 pm wrote:
However, im pretty sure you can do "true" simutaneous procedural executions on multi-CPU systems, but typically just making your procedure calls one after another will be sufficient.
I don't think turing gives you awy to ensure they are simutaneous with out implmenting your own synchronization methods. However their could have been updates to the way procceses work in the newer versions. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
SNIPERDUDE
|
Posted: Sat Oct 23, 2010 10:50 pm Post subject: Re: Can Turing execute two procedure at the same time. |
|
|
CWRules @ October 23rd 2010, 10:31 pm wrote: Dan's right, his suggestion is the best way. But running multiple procedures at once has its uses. Look up processes and the fork command.
In Turing, avoid Processes at all costs. The only time they should be used is for music (because in Turing the program won't move on until the audio file is complete. This creates a way of doing both at the same time).
In general they are terrible as timing is quite random, and can be off to a degree that could mess up your program, even causing crashing or undesired results if relied upon too much. I can guarantee you can do all of your programming using procedures (useful tidbit: In Turing there are some shortcuts, such as you can just type proc in place of procedure) |
|
|
|
|
|
|
|