This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

PONG


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-14-2007 , 11:07   PONG
Reply With Quote #1

Everyone should remember the good ol' days when nearly the first game came out on a console, it was PONG. Well i've done some researching and finally found the source-code for the game PONG. It took them about a year and a half to finish PONG. It was a 158 line code.
The best part? I have the source code and here it is:
PHP Code:
// PONG by Emilie Sutterlin, 10/10/97
// Description: This program is the game pong.
//===================================================================
#include <math.h>
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <constream.h>
#include <dos.h>
//==========GLOBALS AND CONSTANTS========================
const MAX 10;
int lprow=2rprow=2col=2colinc=2rowinc=1row=1oldrowoldcolscorr=0scorl=0;
//==========Prototypes===================================
void ball_bounce ();
void paddle_pong ();
//======================================================
int main (void)
{
clrscr (); fflush(stdin); int num;
textbackground (BLACK);
textcolor (WH|TE); clrscr(); _setcursortype(_NOCURSOR);
//|NTRODUCT|ON
cout<<"WELCOME TO PONG"<<endl<<"This is a two person game."
<<endl<<"The object is to gain points by having your opponent miss hitting the ball with the paddle."
<<endl<<"The game ends when a player reaches 20 points."
<<endl<<"You can stop the game early anytime by pressing either the Enter or Escape key."
<<endl<<"The paddle on the left can be controlled with the arrow up and down keys."
<<endl<<"The paddle on the right can be controlled using the page up and down keys."
<<endl<<"Press any key to begin";
getch(); clrscr();
//CREATE PADDLES
gotoxy (1,2); cout<<"|"<<endl<<"|"<<endl<<"|"<<endl<<"|"<<endl<<"|"<<endl;
gotoxy (79,2); cout<<"|";
gotoxy (79,3); cout<<"|";
gotoxy (79,4); cout<<"|";
gotoxy (79,5); cout<<"|";
gotoxy (79,6); cout<<"|";
//RUN BOTH FUNT|ONS "TOGETHER"
for (;;)
{
ball_bounce ();
fflush (stdin);
paddle_pong ();
}
//end for loop
}//endmain
//--------------------------------------------------------------
void ball_bounce ()
{
int oldcol,oldrow;
while (!
kbhit())
{
oldcol col;
oldrow row;

if (
row == 1rowinc 1;
if (
row == 23rowinc = -1;
if ((
lprow <= row && row lprow+5) && col == 2colinc 1;
if ((
rprow <= row && row rprow+5) && col == 78colinc = -1;

if (
col == 1)
{
scorl += 1;
gotoxy (78,24); cout<<scorl;
if (
scorl == 20)
{
gotoxy (2210); cout<<"The winner is the player on the right.";
_setcursortype(_NOCURSOR);
}
//end if right wins statement
colinc 1;
}
//end if right scores statement

if (col == 80)
{
scorr += 1;
gotoxy (1,24); cout<<scorr;
if (
scorr == 20)
{
gotoxy (22,10); cout<<"The winner is the player on the left.";
_setcursortype(_NOCURSOR);
}
//end if left wins statement
colinc = -1;
}
//end if left scores statement
//set coordinates for next ball to be drawn:
col += colinc;
row += rowinc;

gotoxy (colrow); cout <<"o";//draws new ball
gotoxy (oldcololdrow); cout <<" ";//erases old ball
delay (75);
}
//end while loop
}//end ball_bounce function
//-------------------------------------------------------------------
void paddle_pong ()
{
unsigned ch;
ch getch ();

if (
ch == 13||ch==27)
{
gotoxy(10,10); cout<<"GAME OVER. Press any key to exit.";
getch();
_setcursortype(_NOCURSOR);
exit (
0);
}
else if (
ch != 0);
else
{
switch (
getch ())
{
case 
73:
{
if (
1<lprow)
{
lprow -=1;
gotoxy (1lprow); cout<<"|";
gotoxy (1lprow+5); cout<<" ";
}
//end if
break;
}
//end case 73

case 81:
{
if (
lprow<19)
{
lprow += 1;
gotoxy (1lprow+4); cout<<"|";
gotoxy (1lprow-1); cout<<" ";
}
//end if
break;
}
//end case 81

case 72:
{
if (
1<rprow)
{
rprow -=;
gotoxy (79rprow); cout<<"|";
gotoxy (79rprow+5); cout<<" ";
}
//end if
break;
}
//end case 72

case 80:
{
if (
rprow<19)
{
rprow += 1;
gotoxy (79rprow+4); cout<<"|";
gotoxy (79rprow-1); cout<<" ";
}
//end if
break;
}
//end case 80
}//end switch
}//end else
}//end paddle function
//END OF PROGRAM BY EMILIE SUTTERLIN 


Some of it is identical to AMXX scripting, like the includes, brackets and if statements.
Dark Kingdom is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-14-2007 , 11:11   Re: PONG
Reply With Quote #2

Quote:
Some of it is identical to AMXX scripting, like the includes, brackets and if statements.
Maybe because pawn was made from C! O NOES.

p.s. I doubt this is the original.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-14-2007 , 11:14   Re: PONG
Reply With Quote #3

it is the original I researched it. ;) It just says 10/10/97 because thats when they FOUND the source code.
Dark Kingdom is offline
JVC
BANNED
Join Date: Apr 2007
Location: Indiana
Old 04-14-2007 , 11:20   Re: PONG
Reply With Quote #4

pong was fun to play
JVC is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-14-2007 , 11:22   Re: PONG
Reply With Quote #5

Quote:
Originally Posted by Dark Kingdom View Post
it is the original I researched it. ;) It just says 10/10/97 because thats when they FOUND the source code.
You do realize a two year old could change the date...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-14-2007 , 11:23   Re: PONG
Reply With Quote #6

Yes I know but from what I read that was the original source code.
Dark Kingdom is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-14-2007 , 11:24   Re: PONG
Reply With Quote #7

Looks like crap lol.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-14-2007 , 11:24   Re: PONG
Reply With Quote #8

Wasn't the original made before C?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Dark Kingdom
BANNED
Join Date: Apr 2007
Location: VT
Old 04-14-2007 , 11:25   Re: PONG
Reply With Quote #9

Quote:
Originally Posted by Zenith77 View Post
Looks like crap lol.
I know lol.
Dark Kingdom is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 04-14-2007 , 11:28   Re: PONG
Reply With Quote #10

Quote:
Originally Posted by YamiKaitou View Post
Wasn't the original made before C?
C is really old FYI. So, probably not.

p.s. Dark kingdom, I wasn't talking about the graphics I was referring to the actual code.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode