Error When Executing Turing Program
Author |
Message |
stojanovic
|
Posted: Mon Jan 05, 2009 10:35 am Post subject: Error When Executing Turing Program |
|
|
Greetings! I really appreciate everything you guys are providing!
I'm currently working on my Turing Major Project for my grade 10 programming class. I took my program home during the holidays to work on it. The version of turing I have at home (downloaded from this site) is v. 4.1.1, however, the version we use at school is "v. 4.0.4c" - which I believe is an older version. My problem is this: I brought my program that I've been working on for the past two weeks from home, to school, saved onto a CD. I have different parts to it (i.e. the most recent program, and other backups that aren't as recent but contain lines of code I removed from my main program [I kept these back up "parts" in case I want to re-add anything in them again]). So, when I open this turing program, it takes up to a few seconds (5-10 seconds, sometimes even 15-30 seconds) appearing to freeze briefly. It ends up opening the program, and my lines of code appear - however, when I'm attempting to execute the program I keep receiving some error message, over a blue background (that's the background, but there many features before that background that are supposed to appear, like some basic transitional animation (here's a picture of the message):
P.S The other back up copys, which are not as far (less lines of code, I've also added in some additional features) work fine.
The program I'm having trouble executing also works fine at home on my own personal computer with the more advanced version of turing (could that be the problem? Maybe I've added something in it the more recent version that's conflicting with the older version of turing?).
Thank you for your help, please excuse my ignorance!
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Mon Jan 05, 2009 10:42 am Post subject: RE:Error When Executing Turing Program |
|
|
1. You're right, 4.0.4c is older than 4.1.1
2. You may have added some kind of extra character to the file. Try opening it in another editor, such as Notepad (preferably, Notepad++, look with Google).
If you can open the file with another editor just fine, then it's something funny in the file that Turing is choking on, not your actual code.
If the problem persists, try to apply the changes you've made since your most recent working backup to that backup manually. Do not copy-paste, and make a backup copy of the file you decide to work on first.
Good luck!
|
|
|
|
|
|
stojanovic
|
Posted: Mon Jan 05, 2009 10:49 am Post subject: Re: Error When Executing Turing Program |
|
|
Thank you for your reply!
I'm able to open the lines of code (i.e see all the lines of code), I run into this error message when I try executing the code. "If you can open the file with another editor just fine, then it's something funny in the file that Turing is choking on, not your actual code." - Sorry, but I got the impression that you thought I couldn't open the file at all (as in, not even be able to see the lines of code)? But, thanks I'll try that anyways.
|
|
|
|
|
|
DemonWasp
|
Posted: Mon Jan 05, 2009 2:27 pm Post subject: RE:Error When Executing Turing Program |
|
|
The Turing interpreter is fairly buggy, so there are a few things to check:
1. Do your old programs (backups) execute properly?
2. Can you isolate a single point at which your new program fails, or does it fail immediately?
3. Is anyone else in your class having a similar kind of problem? (Essentially, is it possible that there's some issue with your setup at school? Unlikely.)
If your old programs work, and nobody else is having similar issues, try adding parts of your program back in slowly, continuing until it fails with this error message. This will let you isolate the part of your code that's causing the problem.
|
|
|
|
|
|
Euphoracle
|
Posted: Mon Jan 05, 2009 3:25 pm Post subject: RE:Error When Executing Turing Program |
|
|
It might be a CD reading error. Are the CD drives at your school function? Can you copy it off, and run it from your desktop? Can you read the CD at home? Try bringing it on a different medium, such as a floppy disk, or USB Key. If it is 1 code file, you could even paste it here, and load up compsci.ca at school and copy it into that turing editor. By the description of your situation, it sounds like the CD is damaged, or the CD reader at your school is damaged.
|
|
|
|
|
|
stojanovic
|
Posted: Tue Jan 06, 2009 10:28 am Post subject: Re: Error When Executing Turing Program |
|
|
Thanks again for your replies, I'll try what you suggested. Here's the code for my most recent program (orignially made on turing v. 4.1.1, and the one at school is v. 4.0.4c):
code: |
% Program Created by Fahim Faruk
% Created on December __ - December 27th/08
% This is program will generate a quiz that will ask the user questions about
% Fundamental High school Chemistry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DECLARING VARIABLES, SETTING UP FONTS, AND OTHER CONSTANT PROCEDURES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Import GUI and Setscreen
import GUI
setscreen ("graphics:max;max,nobuttonbar,nocursor,noecho")
% 2. Set Background Colour
colourback (blue)
cls
% 3. Declare Variables
var radio : array 1 .. 4 of int
var a, b, c, d : int
var e, f : int
var g, h : int
var i, j : int
var count, count2 : int := 0
var font, font2, font3 : int
var scoreA, scoreB, scoreH, hardUnlock : int := 0
var score, Xitt, x, y, x1, yy : int := 0
var answer : string
var mypi : int := Pic.FileNew ("ChemBackground.jpg")
var mypi2 : int := Pic.FileNew ("wrong.jpg")
var mypi3 : int := Pic.FileNew ("right.jpg")
var num : string
% 4. Create Fonts
font := Font.New ("Comicsans:14:bold,italic")
font2 := Font.New ("arial:20:bold")
font3 := Font.New ("arial:30:bold")
% 5. Music and Sound Effects
process trunks
loop
Music.PlayFile ("trunks theme.wav")
end loop
end trunks
process swoosh
Music.PlayFile ("swoosh.wav")
end swoosh
process happykids
Music.PlayFile ("happykids.wav")
end happykids
process clap
Music.PlayFile ("Clap.wav")
end clap
process wrong
Music.PlayFile ("wrong.wav")
end wrong
process beep
Music.PlayFile ("Beep.wav")
end beep
process pop
Music.PlayFile ("pop.wav")
end pop
process boo
Music.PlayFile ("boo3.wav")
end boo
fork trunks
% 6. Animation
proc slide
var xmove, ymove : int := 0
fork swoosh
for z3 : 1 .. 130
xmove := xmove + 10
ymove := 50
drawfilloval (xmove, ymove, 150, 50, brightblue)
drawoval (xmove, ymove, 150, 50, black)
drawfilloval (xmove, ymove + 100, 150, 50, red)
drawoval (xmove, ymove + 100, 150, 50, black)
drawfilloval (xmove, ymove + 200, 150, 50, green)
drawoval (xmove, ymove + 200, 150, 50, black)
drawfilloval (xmove, ymove + 300, 150, 50, brightblue)
drawoval (xmove, ymove + 300, 150, 50, black)
drawfilloval (xmove, ymove + 400, 150, 50, red)
drawoval (xmove, ymove + 400, 150, 50, black)
drawfilloval (xmove, ymove + 500, 150, 50, green)
drawoval (xmove, ymove + 500, 150, 50, black)
drawfilloval (xmove, ymove + 600, 150, 50, brightblue)
drawoval (xmove, ymove + 600, 150, 50, black)
end for
cls
end slide
proc nothing
GUI.Quit
end nothing
proc qquit
quit
end qquit
proc lose
mypi2 := Pic.Scale (mypi2, 1050, 800)
Pic.Draw (mypi2, -35, -100, picCopy)
Pic.Free (mypi2)
end lose
proc winner
mypi3 := Pic.Scale (mypi3, 1050, 800)
Pic.Draw (mypi3, -35, -100, picCopy)
Pic.Free (mypi3)
end winner
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BUTTON PROCS %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Start Button's Procedure
proc start
fork beep
cls
end start
% 2. Instruction Button's Procedure
proc ins
fork beep
cls
Font.Draw ("This quiz will test out your knowledge of one of the physical sciences!", 100, maxy - 100, font2, black)
delay (400)
Font.Draw ("You will answer 10 questions related to Chemistry in NORMAL mode.", 90, maxy - 150, font2, black)
delay (400)
Font.Draw ("Each question includes 3 multiple choices, and only one is correct.", 60, maxy - 200, font2, black)
delay (400)
Font.Draw ("If you answer a question correctly, you will be rewarded 100 points!", 98, maxy - 250, font2, black)
delay (400)
Font.Draw ("If you answer a question incorrectly, you will suffer a loss of 50 points", 98, maxy - 300, font2, black)
delay (400)
locate (35, 52)
put "[Press any key to continue]"
loop
exit when hasch
end loop
GUI.Quit
end ins
% 3. Credits Button's Procedure
proc creds
fork beep
%Resets y counter
y := 0
loop
exit when y = 1100
View.Set ("offscreenonly")
Font.Draw ("Quiz Coded/Created by:", 360, y, font3, yellow)
Font.Draw ("Fahim Faruk", 380, y - 40, font3, yellow)
Font.Draw ("Music:", 450, y - 400, font3, yellow)
Font.Draw ("Trunk's Theme From Dragon Ball Z Anime", 190, y - 440, font3, yellow)
Font.Draw ("Zero's Theme, from Megaman X series (game)", 270, y - 480, font3, yellow)
Font.Draw ("Other Sound Effects:", 270, y - 560, font3, yellow)
Font.Draw ("http://www.partnersinrhyme.com/pir/PIRsfx.shtml", 270, y - 600, font3, yellow)
y := y + 1
delay (12)
View.Update
cls
end loop
View.Set ("nooffscreenonly")
GUI.Quit
end creds
% 4. Exit Button's Procedure
proc exit1
GUI.Quit
end exit1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Intro Screeen %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fork beep
% 1. Set Background Colour and Font Colour
colorback (blue)
color (white)
cls
loop
Xitt := 0
score := 0
x := 0
% 2. Numerous Oval-Shaped Rings
loop
exit when count = 1000
count := count + 1
randint (a, 0, maxx)
randint (b, 0, maxy)
randint (e, 0, maxx)
randint (f, 0, maxy)
randint (g, 0, maxx)
randint (h, 0, maxy)
randint (i, 0, maxx)
randint (j, 0, maxy)
randint (c, 0, maxx div 2)
randint (d, 0, maxy div 2)
drawoval (maxx div 2, maxy div 2, e, f, blue)
drawoval (maxx div 2, maxy div 2, a, b, yellow)
drawoval (maxx div 2, maxy div 2, g, h, blue)
drawoval (maxx div 2, maxy div 2, i, j, 62)
drawoval (maxx div 2, maxy div 2, i, j, purple)
delay (7)
end loop
% 2. Create Black Tunnel-Like Effect
for blah : 1 .. 1
drawfilloval (maxx div 2, maxy div 2, 50, 50, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 100, 100, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 150, 150, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 200, 200, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 250, 250, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 300, 300, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 350, 350, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 400, 400, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 450, 450, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 500, 500, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 550, 550, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 600, 600, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 650, 650, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 700, 700, black)
delay (50)
end for
% 3. Determine Font and Font Contents
Font.Draw ("Prepare Yourself!", maxx div 2 - 150, maxy div 2 - 35, font, white)
delay (2000)
% 4. Insert Chemistry Background ("mypic")
% 5. Determine Font and Font Contents + Create Intro Buttons (Enter and Exit)
loop
Pic.Draw (mypi, maxx div 200, maxy div 200, picCopy)
Font.Draw ("THE CHEMISTRY QUIZ", maxx div 2 - 200, maxy div 2 - 10, font3, white)
var take : int := GUI.CreateButtonFull (maxx div 2 - 400, 10, 118, "Start", start, 0, '^x', true)
var exxit : int := GUI.CreateButtonFull (maxx div 2 - 200, 10, 0, "Exit!", exit1, 0, '^x', true)
var cred : int := GUI.CreateButtonFull (maxx div 2, 10, 0, "Credits!", creds, 0, '^x', true)
var instructions : int := GUI.CreateButtonFull (maxx div 2 + 200, 10, 0, "Instructions!", ins, 0, '^x', true)
loop
exit when GUI.ProcessEvent
end loop
GUI.ResetQuit
GUI.Dispose (take)
GUI.Dispose (exxit)
GUI.Dispose (cred)
GUI.Dispose (instructions)
end loop
end loop
|
|
|
|
|
|
|
stojanovic
|
Posted: Wed Jan 07, 2009 10:38 am Post subject: Re: Error When Executing Turing Program |
|
|
Hey, thanks for all of your help. As Euphoracle suggested - it ended up being a CD reading error (the CD seemed to be damaged). I deducted this after opening and executing the program successfully from the deskptop. The only things I had to take out though (when running from the desktop) were: GUI.ResetQuit, and a music file that I forked (i.e "fork _____").
Is there anything I can use as a substitute for "GUI.ResetQuit"?
Another problem I'm running into is this: when I fork a music file ("fork ____"), so it runs with the rest of the program, the initial animation that starts up the intro screen (numerous ovals appearing in definite patterns from the center) undergoes very slowly, with each individual oval (or sometimes 3-4 at a time) appearing every 2-3 seconds. It's supposed to flow together, and happen pretty quickly though. When I take out the "fork _______" it works fine. I think this might be a problem with the turing at school, because it seems to work fine at home (although, I had to copy and paste it into a new folder, because it seemed to run into the same problem at home aswell while in a certain folder...???)
Turing: |
fork trunks % - PROBLEM HERE
% 6. Animation
proc slide
var xmove, ymove : int := 0
fork swoosh
for z3 : 1 .. 130
xmove := xmove + 10
ymove := 50
drawfilloval (xmove, ymove, 150, 50, brightblue)
drawoval (xmove, ymove, 150, 50, black)
drawfilloval (xmove, ymove + 100, 150, 50, red)
drawoval (xmove, ymove + 100, 150, 50, black)
drawfilloval (xmove, ymove + 200, 150, 50, green)
drawoval (xmove, ymove + 200, 150, 50, black)
drawfilloval (xmove, ymove + 300, 150, 50, brightblue)
drawoval (xmove, ymove + 300, 150, 50, black)
drawfilloval (xmove, ymove + 400, 150, 50, red)
drawoval (xmove, ymove + 400, 150, 50, black)
drawfilloval (xmove, ymove + 500, 150, 50, green)
drawoval (xmove, ymove + 500, 150, 50, black)
drawfilloval (xmove, ymove + 600, 150, 50, brightblue)
drawoval (xmove, ymove + 600, 150, 50, black)
end for
cls
end slide
proc nothing
GUI.Quit
end nothing
proc qquit
quit
end qquit
proc lose
mypi2 := Pic.Scale (mypi2, 1050, 800)
Pic.Draw (mypi2, - 35, - 100, picCopy)
Pic.Free (mypi2 )
end lose
proc winner
mypi3 := Pic.Scale (mypi3, 1050, 800)
Pic.Draw (mypi3, - 35, - 100, picCopy)
Pic.Free (mypi3 )
end winner
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BUTTON PROCS %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Start Button's Procedure
proc start
fork beep
cls
end start
% 2. Instruction Button's Procedure
proc ins
fork beep
cls
Font.Draw ("This quiz will test out your knowledge of one of the physical sciences!", 100, maxy - 100, font2, black)
delay (400)
Font.Draw ("You will answer 10 questions related to Chemistry in NORMAL mode.", 90, maxy - 150, font2, black)
delay (400)
Font.Draw ("Each question includes 3 multiple choices, and only one is correct.", 60, maxy - 200, font2, black)
delay (400)
Font.Draw ("If you answer a question correctly, you will be rewarded 100 points!", 98, maxy - 250, font2, black)
delay (400)
Font.Draw ("If you answer a question incorrectly, you will suffer a loss of 50 points", 98, maxy - 300, font2, black)
delay (400)
locate (35, 52)
put "[Press any key to continue]"
loop
exit when hasch
end loop
GUI.Quit
end ins
% 3. Credits Button's Procedure
proc creds
fork beep
%Resets y counter
y := 0
loop
exit when y = 1100
View.Set ("offscreenonly")
Font.Draw ("Quiz Coded/Created by:", 360, y, font3, yellow)
Font.Draw ("Fahim Faruk", 380, y - 40, font3, yellow)
Font.Draw ("Music:", 450, y - 400, font3, yellow)
Font.Draw ("Trunk's Theme From Dragon Ball Z Anime", 190, y - 440, font3, yellow)
Font.Draw ("Zero's Theme, from Megaman X series (game)", 270, y - 480, font3, yellow)
Font.Draw ("Other Sound Effects:", 270, y - 560, font3, yellow)
Font.Draw ("http://www.partnersinrhyme.com/pir/PIRsfx.shtml", 270, y - 600, font3, yellow)
y := y + 1
delay (12)
View.Update
cls
end loop
View.Set ("nooffscreenonly")
GUI.Quit
end creds
% 4. Exit Button's Procedure
proc exit1
GUI.Quit
end exit1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Intro Screeen %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fork beep
% 1. Set Background Colour and Font Colour
colorback (blue)
color (white)
cls
loop
Xitt := 0
score := 0
x := 0
% 2. Numerous Oval-Shaped Rings
loop
exit when count = 1000
count := count + 1
randint (a, 0, maxx)
randint (b, 0, maxy)
randint (e, 0, maxx)
randint (f, 0, maxy)
randint (g, 0, maxx)
randint (h, 0, maxy)
randint (i, 0, maxx)
randint (j, 0, maxy)
randint (c, 0, maxx div 2)
randint (d, 0, maxy div 2)
drawoval (maxx div 2, maxy div 2, e, f, blue)
drawoval (maxx div 2, maxy div 2, a, b, yellow)
drawoval (maxx div 2, maxy div 2, g, h, blue)
drawoval (maxx div 2, maxy div 2, i, j, 62)
drawoval (maxx div 2, maxy div 2, i, j, purple)
delay (7)
end loop
|
Mod Edit: Tags were broken so fixed that up. Oh and syntax tags usually look better code: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
|
DemonWasp
|
Posted: Wed Jan 07, 2009 11:09 am Post subject: RE:Error When Executing Turing Program |
|
|
Turing isn't actually multi-threaded, so using "fork" just tells Turing to manage simultaneous execution.
It is spectacularly bad at this.
What you seem to be seeing here is one thread getting resource-starved (the one that draws the ovals) while the other noms all the resources. The reason it would work better on your home computer likely has to do with your home computer being faster, and Turing's thread-resource-allocation methods being improved in later versions.
Unfortunately, there's probably no real fix to this, short of not using Turing, which is well beyond the needs of the assignment.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
stojanovic
|
Posted: Thu Jan 08, 2009 10:09 am Post subject: Re: Error When Executing Turing Program |
|
|
Thanks!
Oh I see, well I suppose I'll just have to tell the teacher to mark it from his home computer. I hope his computer has the necissary speed. (I guess i'll save the installation file of the newer version of turing, and my project)...
Thanks for all your help!
If you are interested in checking out what I have so far (I still have to add in the questions into this program):
Description: |
|
Download |
Filename: |
BIGPROt.T |
Filesize: |
8.74 KB |
Downloaded: |
121 Time(s) |
|
|
|
|
|
|
|
|