
-----------------------------------
riya
Tue Jan 20, 2015 10:38 pm

Turing Final Project
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?
= 0 then
        scene := 0
    end if

-----------------------------------
Tony
Wed Jan 21, 2015 7:57 pm

RE:Turing Final Project
-----------------------------------
[code]
loop
   ...
   ...
   # success, we can move on
   exit
   ...
   ...
end loop
[/code]

use loops to repeat stuff. exit once whatever condition is met.

-----------------------------------
riya
Wed Jan 21, 2015 8:08 pm

RE:Turing Final Project
-----------------------------------
how do I post a file on here? Turing is killing me omg

-----------------------------------
riya
Wed Jan 21, 2015 8:11 pm

RE:Turing Final Project
-----------------------------------
OMG Tony! I got the else to work but, it only works when I have one put statement and if I add another one or anything it crashes.  What should I do?

-----------------------------------
Tony
Wed Jan 21, 2015 8:13 pm

RE:Turing Final Project
-----------------------------------
lets see the code. How does it crash (is there an error?)

-----------------------------------
riya
Wed Jan 21, 2015 8:15 pm

RE:Turing Final Project
-----------------------------------
okay this is the code. 



 if crosspath = "East" or crosspath = "east" then

        cls
        fd := fd + 0
        put "\t\t\t\t\t\t\t\t Fairy Dust: ", fd
        Draw.FillStar (0, 0, star, star, yellow)
        Draw.FillStar (maxx - star, 0, maxx, star, yellow)
        delay (2900)
        put "The Unknown: Oh no! The goblin managed to catch up to you!"
        put "After demanding one of your precious Fairy Dust and scaring"
        put "you very much so, he is off on his way."
        delay (1000)
        fd := fd - 1
        put "\t\t\t\t\t\t\t\t Fairy Dust: ", fd

        delay (4000)
        put ""
        put "The Unknown: After, a little walking you see a sign: LAND OF DWARFS "
        put "There you meet Grumpy and Happy, and after a few laughs"
        put "they take you over to their portal. You can cross the portal"
        put "only on one condition: you must solve their riddle!"
        delay (5900)
        cls
        put "\t\t\t\t\t\t\t\t Fairy Dust: ", fd
        Draw.FillStar (0, 0, star, star, yellow)
        Draw.FillStar (maxx - star, 0, maxx, star, yellow)
        delay (2900)
        riddle := 1
        put "The Unknown: The riddle is: "
        put ""
        put "What is more powerful than God?"
        put "What is more evil than the Devil?"
        put "The poor have it."
        put "The rich need it."
        put "If you eat it you will die."
        put "Hint: The answer is one word! Type in the word: "
        get r1
    end if


    if r1 = "nothing" or r1 = "Nothing" then
        put ""
        put "The Unknown: Well done! Your smartness is evident. The dwarfs let you"
        put "go through their portal and you arrive a little late, but"
        put "what matters is that you are there! Your journey is complete!"
        put "You have made it with two Fairy Dust left! Type 'again' to"
        put "replay!"
        get again
    else
    
        put "Wrong answer! You have lost one life!" 
        end if 

    
     if again = "again" or again = "Again" then
                scene := 1
            end if

    if fd >= 0 then
        scene := 0
    end if

if I add anything even another put statement to the else right up there it crashes!

-----------------------------------
riya
Wed Jan 21, 2015 8:19 pm

RE:Turing Final Project
-----------------------------------
and what I need to add to that else is this: 
fd := fd - 1
        put "\t\t\t\t\t\t\t\t Fairy Dust: ", fd
and then put the loop in to take it back to the riddle, but if i use this loop, will it mess anything else up? I have one big loop for the entire program and many if statements. Will the loop work?  I AM SO SORRY FOR BOMBARDING YOU WITH Q'S

-----------------------------------
riya
Wed Jan 21, 2015 9:16 pm

RE:Turing Final Project
-----------------------------------
tony I really need your help

-----------------------------------
riya
Wed Jan 21, 2015 9:45 pm

RE:Turing Final Project
-----------------------------------
nvm I got it! Thanks for your help!

-----------------------------------
Tony
Thu Jan 22, 2015 1:42 pm

RE:Turing Final Project
-----------------------------------
I'm glad that you figured out this particular issue, but I'd like to stress this one important technique for figuring out the problems faster:

- pay attention to the error messages (you haven't mentioned those, even after having been asked).
- in a separate file, find the minimal amount of code that reproduce the same error.

E.g. for an error with a if-else structure, we really don't need all of those puts, delays, and draws. It's difficult to understand large blocks of code, but you can cut it down to a small example
[code]
if 1 = 2 then
   put "A"
else
  put "B"
end if
[/code]
and study that. If the error is still there, it will be much easier to find.
