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

Username:   Password: 
 RegisterRegister   
 ping pong
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
air_force91




PostPosted: Thu Nov 20, 2003 9:12 pm   Post subject: ping pong

I wanted to display a ping pong game...REMEMBER:im a beginner

lol.

loop

put "! $ !"

delay(10)

put "! $ !"

delay(10)

put "! $!"

delay(10)

put "! $ !"

delay(10)

put "! $ !"

end loop


neways...i wanted to know...how could i move just the dollar sign back and forth within the bars (! !) instead of repeating the bars on the screen...thanx...
Sponsor
Sponsor
Sponsor
sponsor
thoughtful




PostPosted: Thu Nov 20, 2003 10:14 pm   Post subject: (No subject)

Bro you should stop posting 2 topics and try doing some work on your own. Or you will get the turing gurus mad Evil or Very Mad Evil or Very Mad Evil or Very Mad
Mazer




PostPosted: Thu Nov 20, 2003 10:24 pm   Post subject: (No subject)

try this:
code:

var pos := 0 % position of the ball
var move := 1 % 1 = move right, -1 = move left

loop
    put "!", repeat (" ", pos), "$", repeat (" ", 5 - pos), "!"
    % put the !, then a number of spaces equal to the space between the left paddle and the ball, then the ball, and more space, then the right paddle
    delay (60) % 10ms is pretty short, for something so simple a bigger delay is better
    cls

    pos += move % increase the position by move (so, if move is negative, the ball moves to the left)
    if pos = 0 or pos = 5 then % if the ball hits a paddle, switch the direction
        move *= -1
    end if
end loop


thoughtful, i'm guessing the double post was a bug in the forum. and as for the program he did try doing it on his own.
AsianSensation




PostPosted: Thu Nov 20, 2003 10:32 pm   Post subject: (No subject)

lol, I didn't even notice there were two posts...

anyways, Mazer did it the smart way, he actually thought about it, if you want to learn how to problem solve, use his, otherwise, if you are lazy, use mine, it's so much simpler when it comes to understanding. Razz
Mazer




PostPosted: Thu Nov 20, 2003 10:37 pm   Post subject: (No subject)

yeah, yours is much simpler asian, but i don't like to use locate. i don't really know why...
thoughtful




PostPosted: Fri Nov 21, 2003 12:33 am   Post subject: (No subject)

Hey i am sorry for criticising you airforce man....didnt know it was a bug.
morgoth




PostPosted: Sun Nov 23, 2003 9:37 am   Post subject: (No subject)

LOL I was just thinking about the locate command and how much I hate it as well LOL Very Happy

-CHEERS!
air_force91




PostPosted: Sun Nov 23, 2003 12:03 pm   Post subject: (No subject)

wow...u got it all wrong...seriously...i only posted once...and i do my work on my own...is it a crime to ask ppl better than u out there for some help? and second of all...im not a "bro" or a "man"...im a girl...seriously...are only boys interested in planes and airforce? Rolling Eyes
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Sun Nov 23, 2003 12:05 pm   Post subject: (No subject)

actually its not the planes and airforce.. its compsci.
thoughtful




PostPosted: Sun Nov 23, 2003 6:54 pm   Post subject: (No subject)

LOL, its actually very rare to find girls here. Now tony might give you better attention if you are hot cause he told me his school doesn't has a lot of em Razz Razz Twisted Evil Twisted Evil
Andy




PostPosted: Sun Nov 23, 2003 6:56 pm   Post subject: (No subject)

who's a girl?
thoughtful




PostPosted: Sun Nov 23, 2003 7:01 pm   Post subject: (No subject)

airforce_91
Tony




PostPosted: Sun Nov 23, 2003 7:03 pm   Post subject: (No subject)

umm... yeah... its true Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
air_force91




PostPosted: Sun Nov 23, 2003 8:44 pm   Post subject: (No subject)

u know...seriously...girls are interested in programming as well...ughhh... Rolling Eyes ....
Tony




PostPosted: Sun Nov 23, 2003 9:50 pm   Post subject: (No subject)

air_force91 wrote:
girls are interested in programming as well


umm... no Confused not to my knowledge Thinking
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: