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

Username:   Password: 
 RegisterRegister   
 asuming
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fabulos




PostPosted: Tue May 03, 2005 5:50 pm   Post subject: asuming

is there a command in turing which "assumes" a particular procedure?

ex..
code:

                          if m < x2-rock_radius then
                          m:= x2 + rock_radius +20
                          end if


I only want the program to assume this and carry it out, if the "if" statement is true, and after it has been carried out, i want it to return to the way it was before. I don't want it to be visible to the person who is using this program. Can this be done with int numbers???
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Tue May 03, 2005 7:12 pm   Post subject: (No subject)

Please be a little clearer in what you're asking. Several thoughts popped into my mind while reading.
1) look into boolean variables, they may help
2) when you say "I don't want it to be visible to the person who is using this program.", are you referring to the code itself, or the changes? If you mean code, I hope you realize you can compile code so that it becomes an .exe file.
If you mean changes, I guess you could use temporary variables...but again, since I'm not sure what you're asking I can't be more specific.
fabulos




PostPosted: Tue May 03, 2005 8:17 pm   Post subject: (No subject)

OK....i'm making a asteroid game, and i'm having problems with making the lasers of the ship collide with the asteroid (i got it to collide, but i can't control when to collid).

So i realized that whenever i shoot to the RIGHT of the asteroid and miss, it recognizes that it missed the asteroid and thats what i want (if i missed)

e.g ------------------------- asteroid
-------------------------------------------------bullet
-------------------------------------------------: : : :----- = MISS!!
------------------------------------------------spaceship


However, when i shoot the the LEFT of the asteroid and miss it, it still recognizes that it HIT the asteroid, which i don't want, because it missed.

eg ---------------------------- asteroid

---------bullet
---------: : : : ----------------------------------- = HIT!!
------- spaceship

So what i want is that whenever the laser is shot to the LEFT of the asteroid and it MISSES, if i could somehow make the program ASSUME that it is to the RIGHT of the asteroid, it'll miss the asteroid and the asteroid will continue on.


i hope u understand my crappy diagrams.... i used the "-------" just to help my spacing....they don't ahve ne meaning in the diagram.
Tony




PostPosted: Wed May 04, 2005 3:43 pm   Post subject: (No subject)

you check for two conditions.
pseudo-code wrote:

if laser is to the right of the left side and laser is to the left of the right side then
laser has his the asteroid


Tutorial on IF statements
fabulos




PostPosted: Wed May 04, 2005 5:41 pm   Post subject: (No subject)

how would i say "if the laser is LEFT of the asteroid..." in an actual working statment.

"x2" is the x variable for the asteroid

"u" is the x variable for the spaceship
Delos




PostPosted: Wed May 04, 2005 8:13 pm   Post subject: (No subject)

<
>
<=
>=
=
not= or ~=
and
or


Those are pretty useful operators.
fabulos




PostPosted: Wed May 04, 2005 9:46 pm   Post subject: (No subject)

alrite thanks for the help...i got it to wokr.. Laughing Laughing
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  [ 7 Posts ]
Jump to:   


Style:  
Search: