PAGE 2......
SOURCE CODES:
Turbo Pascal :
Source code for opening screen:
setcolor(white);
SetTextStyle(defaultfont, HorizDir, 1);
moveto(1, 30);
outtext('PROLAN CASE STUDY:');
moveto(1, 50);
outtext('----------------------------------------------------------------------------------');
moveto(1, 70);
outtext(' ²²²²²² ²² ²²²²² ²²²²²² ²²²² ²²²²² ²²²²²² ²²²²² ²²²²² ');
moveto(1, 80);
outtext(' ²² ²² ²² ²² ²² ²² ²² ²² ²² ² ²² ');
moveto(1, 90);
outtext(' ²² ²² ²² ²²² ²² ²²²²²² ²² ²²² ²² ²² ² ²²²² ');
moveto(1, 100);
outtext(' ²² ²² ²² ²² ²² ²² ²² ²² ²² ² ²² ');
moveto(1, 110);
outtext(' ²² ²² ²²²²² ²² ²² ²² ²²²²² ²² ²²²²² ²²²²² ');
moveto(1, 140);
outtext(' designed, programmed, and HACKED by JEFF');
moveto(1, 160);
outtext('----------------------------------------------------------------------------------');
moveto(1, 200);
outtext(' Use keypad to place x''s and o''s (squares : P) according to position.');
moveto(1, 220);
outtext(' For example, [1] would correspond to the bottom left square. In the' );
moveto(1, 240);
outtext(' right hand of the screen, the current players color + piece is shown ');
moveto(1, 260);
outtext(' ');
moveto(1, 280);
outtext(' TO QUIT AT ANY TIME PRESS (escape).');
Source code for gridlines:
procedure drawbg;
begin
setcolor(green);
line(((getmaxx div 2) div 2) + 50, 50, ((getmaxx div 2) div 2) + 50, getmaxy - 50);
line((getmaxx div 2) + ((getmaxx div 2) div 2) - 50, 50, (getmaxx div 2) + ((getmaxx div 2) div 2) - 50, getmaxy - 50);
line(50,((getmaxy div 2) div 2) + 50, getmaxx - 50, ((getmaxy div 2) div 2)+ 50) ;
line(50,(getmaxy div 2) + ((getmaxy div 2) div 2) - 50, getmaxx - 50, (getmaxy div 2) + ((getmaxy div 2) div 2) - 50);
end;
Source code for X and O graphics:
procedure drawO;
var i : integer;
begin
i := ukey;
setcolor(red);
setfillstyle(solidfill, red);
circle(posx[i - 48], posy[i - 48], 50);
floodfill(posx[i -48], posy[i - 48], 4);
setcolor(black);
setfillstyle(solidfill, black);
circle(posx[i - 48], posy[i - 48], 40);
floodfill(posx[i -48], posy[i - 48], 0);
end;
procedure drawX;
var i : integer;
begin
i := ukey;
setcolor(blue);
setfillstyle(solidfill, blue);
bar3d(posx[i - 48] - 30, posy[i - 48] - 30, posx[i - 48] + 30, posy[i - 48] + 30, 0, topon);
end;
Source codes for other items ( tic-tac-toe game, etc.. )
program tictactoe(input, output);
uses crt, graph;
type xno = (X, O, na);
var XO : array[1..3,1..3] of xno;
plays,
Owins,
Xwins,
ukey : integer;
turn : xno;
posx : array[1..9] of integer;
posy : array[1..9] of integer;
row : integer;
col : integer;
quit,
winner : boolean;
procedure setupgraphix;
var gd, gm : integer;
begin
gd := detect;
initgraph(gd, gm, '');
if graphresult <> grOk then
halt(1);
end;
procedure initpos;
var i : integer;
begin
for i := 1 to 9 do
begin
case i of
1,4,7 : posx[i] := 130;
2,5,8 : posx[i] := 320;
3,6,9 : posx[i] := 500;
end;
case i of
7..9 : posy[i] := 100;
4..6 : posy[i] := 240;
1..3 : posy[i] := 380;
end;
end;
end;
procedure check;
begin
case (ukey - 48) of
1,4,7 : row := 3;
2,5,8 : row := 2;
3,6,9 : row := 1;
end;
case (ukey - 48) of
7..9 : col := 3;
4..6 : col := 2;
1..3 : col := 1;
end;
end;
procedure initxo;
var i, j : integer;
begin
for i := 1 to 3 do
for j := 1 to 3 do
xo[i][j] := na;
end;
procedure win2;
begin
setcolor(white);
setfillstyle(solidfill, black);
bar3d((getmaxx div 2) - 50,1, (getmaxx div 2) + 50, 13, 0, topon);
moveto((getmaxx div 2) - 45,4);
setcolor(white);
outtext('RED WINS!!!');
winner := true;
Owins := Owins + 1;
end;
procedure win;
begin
setcolor(white);
setfillstyle(solidfill, black);
bar3d((getmaxx div 2) - 50,1, (getmaxx div 2) + 50, 13, 0, topon);
moveto((getmaxx div 2) - 48,4);
setcolor(white);
outtext('BLUE WINS!!!');
winner := true;
Xwins := Xwins + 1;
end;
procedure chkwin;
begin
if xo[1][1] = x then
if xo[1][2] = x then
if xo[1][3] = x then
win;
if xo[2][1] = x then
if xo[2][2] = x then
if xo[2][3] = x then
win;
if xo[3][1] = x then
if xo[3][2] = x then
if xo[3][3] = x then
win;
if xo[1][1] = x then
if xo[2][1] = x then
if xo[3][1] = x then
win;
if xo[1][2] = x then
if xo[2][2] = x then
if xo[3][2] = x then
win;
if xo[1][3] = x then
if xo[2][3] = x then
if xo[3][3] = x then
win;
if xo[1][1] = x then
if xo[2][2] = x then
if xo[3][3] = x then
win;
if xo[1][3] = x then
if xo[2][2] = x then
if xo[3][1] = x then
win;
if xo[1][1] = o then
if xo[1][2] = o then
if xo[1][3] = o then
win2;
if xo[2][1] = o then
if xo[2][2] = o then
if xo[2][3] = o then
win2;
if xo[3][1] = o then
if xo[3][2] = o then
if xo[3][3] = o then
win2;
if xo[1][1] = o then
if xo[2][1] = o then
if xo[3][1] = o then
win2;
if xo[1][2] = o then
if xo[2][2] = o then
if xo[3][2] = o then
win2;
if xo[1][3] = o then
if xo[2][3] = o then
if xo[3][3] = o then
win2;
if xo[1][1] = o then
if xo[2][2] = o then
if xo[3][3] = o then
win2;
if xo[1][3] = o then
if xo[2][2] = o then
if xo[3][1] = o then
win2;
end;
procedure showwins;
var tempx,
tempo : string;
begin
setcolor(black);
setfillstyle(solidfill, black);
bar3d(1, getmaxy - 20, getmaxx, getmaxy, 0, topon);
setcolor(red);
moveto((getmaxx div 2) - 180, getmaxy - 10);
str(owins, tempo);
outtext('''O'' Wins (red) : ');
outtext(tempo);
moveto(getx + 15, gety);
str(xwins, tempx);
setcolor(blue);
outtext('''X'' Wins (blue) : ');
outtext(tempx);
end;
begin
setupgraphix;
randomize;
Owins := 0;
Xwins := 0;
repeat until keypressed;
repeat
cleardevice;
showwins;
quit := false;
ukey := 1;
plays := 0;
winner := false;
initpos;
initxo;
drawbg;
if random(2) = 1 then
turn := X
else
turn := O;
repeat
moveto(getmaxx - 50, 1);
setcolor(black);
setfillstyle(solidfill, black);
bar3d(getmaxx - 55, 1, getmaxx, 15, 0, topon);
if turn = x then
begin
setcolor(blue);
outtext('Û')
end
else if turn = o then
begin
setcolor(red);
outtext('O');
end;
ukey := ord(readkey);
if (ukey >= 49) and (ukey <= 57) then
begin
check;
if (XO[row][col] = na) then
begin
plays := plays + 1;
if turn = X then
drawx;
if turn = O then
drawO;
XO[row][col] := turn;
if turn = x then
turn := o
else if turn = o then
turn := x;
end;
end;
chkwin;
showwins;
until (winner = true) or (ukey = 27) or (plays = 9);
moveto(getmaxx - 50, 1);
setcolor(black);
setfillstyle(solidfill, black);
bar3d(getmaxx - 55, 1, getmaxx, 15, 0, topon);
setcolor(white);
bar3d((getmaxx div 2) - 75,(getmaxy div 2) - 3, (getmaxx div 2) + 75,(getmaxy div 2) + 10, 0, topon);
moveto((getmaxx div 2) - 65,getmaxy div 2);
outtext('Play again? [y/n]');
if ukey <> 27 then
begin
repeat
ukey := ord(readkey);
until (ukey = 121) or (ukey = 110);
end
else if ukey = 27 then
quit := true;
until (quit = true) or (ukey = 110);
closegraph;
end.
Visual Basic :
Source code for opening screen:
Private Sub Timer1_Timer()
If Timer1.Interval = 9000 Then
Form2.Show
Form1.Hide
Timer1.Enabled = False
End If
End Sub
Source code for tic-tac-toe game:
Dim turn As String
Private Sub cmd_board_Click(index As Integer)
cmd_board(index).Caption = "X"
cmd_board(index).Enabled = False
If turn = "O" Then
turn = "X"
ElseIf turn = "X" Then
turn = "O"
End If
If turn = "X" Then
cmd_board(index).Caption = "O"
cmd_board(index).Enabled = False
End If
If turn = "O" Then
cmd_board(index).Caption = "X"
cmd_board(index).Enabled = False
End If
If cmd_board(0).Caption = "X" And cmd_board(1).Caption = "X" And cmd_board(2).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER" MsgBox "? ? ? ? ? ? ?", vbQuestion, "You've got MAIL !"
ElseIf cmd_board(3).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(5).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(6).Caption = "X" And cmd_board(7).Caption = "X" And cmd_board(8).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(0).Caption = "X" And cmd_board(3).Caption = "X" And cmd_board(6).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(1).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(7).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(2).Caption = "X" And cmd_board(5).Caption = "X" And cmd_board(8).Caption = "X" Then MsgBox " X Wins! ", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(0).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(8).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
ElseIf cmd_board(2).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(6).Caption = "X" Then MsgBox "X Wins!", vbMsgBoxRtlReading, "WINNER"
End If
If cmd_board(0).Caption = "X" And cmd_board(1).Caption = "X" And cmd_board(2).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(3).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(5).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(6).Caption = "X" And cmd_board(7).Caption = "X" And cmd_board(8).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(0).Caption = "X" And cmd_board(3).Caption = "X" And cmd_board(6).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(1).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(7).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(2).Caption = "X" And cmd_board(5).Caption = "X" And cmd_board(8).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(0).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(8).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
ElseIf cmd_board(2).Caption = "X" And cmd_board(4).Caption = "X" And cmd_board(6).Caption = "X" Then Text1.Text = " X Wins ! Start a new game"
End If
If cmd_board(0).Caption = "O" And cmd_board(1).Caption = "O" And cmd_board(2).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(3).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(5).Caption = "O" Then MsgBox "O Wins! ", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(6).Caption = "O" And cmd_board(7).Caption = "O" And cmd_board(8).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(0).Caption = "O" And cmd_board(3).Caption = "O" And cmd_board(6).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(1).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(7).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(2).Caption = "O" And cmd_board(5).Caption = "O" And cmd_board(8).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(0).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(8).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
ElseIf cmd_board(2).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(6).Caption = "O" Then MsgBox "O Wins!", vbMsgBoxRtlReading, "GREAT !"
End If
If cmd_board(0).Caption = "O" And cmd_board(1).Caption = "O" And cmd_board(2).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(3).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(5).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(6).Caption = "O" And cmd_board(7).Caption = "O" And cmd_board(8).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(0).Caption = "O" And cmd_board(3).Caption = "O" And cmd_board(6).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(1).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(7).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(2).Caption = "O" And cmd_board(5).Caption = "O" And cmd_board(8).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(0).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(8).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
ElseIf cmd_board(2).Caption = "O" And cmd_board(4).Caption = "O" And cmd_board(6).Caption = "O" Then Text1.Text = " O Wins ! Start a new game"
End If
End Sub
DISPLAY SAMPLES:

Illustration 002 01: The opening screen

Illustration 002 02: Tic-tac-toe game screen

Illustration 003 01: Opening Screen

Illustration 003 02: Game Screen

Illustration 003 03: The game screen menu controls
CONCLUSION:
RECOMMENDATION:
For our program ( tic-tac-toe ) :
In general :
BIBLIOGRAPHY:
Hands on Turbo Pascal : An Introduction to Object-Oriented Programming ( By Larry Joel Goldstein )
Visual Basic For Windows ( Richard Mansfield )
Visual Basic Object-Oriented Programming ( By Gene Swartzfager )
Visual Basic 6 Complete
CURRICULUM VITAE:
RODOLFO Y. PONFERRADA, JR.
8300 Dapitan Street Guadalupe, Makati City
0919-6745590
AMA Computer College Second Year Student ( 2001 present )
Letran College ( 1994-97 )
Seminars Attended : Network Security ( AMA-CC Pasig ) 2002
Age : 19
Height : 5 7"
Weight : 140 pounds
Computer Skills : Knowledge in Turbo Pascal, Turbo C, Visual C ++, Visual Foxpro -programming
Knowledge in Web Designing
Favorite Food : kare-kare
Favorite Drink : water, SanMiguel or Red Horse Extra Strong
Favorite Fruits : banana
Favorite Cartoon : Ghostfighter
If I were somebody
else, who would it be ? - guess who ? -
JEFFREY JABSON
AMA Computer College Second Year Student ( 2001-present )
AMA Computer Learning Center Finished 2-year course, Computer Systems Design and Programming ( 1996-98 )
Seminars Attended : Ultimate Job-Hunting Strategies ( AMA-CLC Pasig ) 1998
Network Security ( AMA-CC Pasig ) 2002
Job Experience : McDonalds Pasig Plaza 1996
Standard Chartered Bank Ortigas, Pasig City 1998
Pasig Computer Center 2001
Total Accumulated Earnings:
McDonalds : P 6,000 @ 3 months
Standard Chartered : P 15,000 @ 6 months
Pasig Computer : P 3,600 @ 2 months
Computer Skills : Knowledge in Visual Basic, Turbo Pascal, Turbo C programming,
Knowledge in Web Designing,
Knowledge in creating Computer Viruses,
No knowledge in Computer Hacking .but willing to learn !
Favorite Food : spaghetti and chicken
Favorite Drink : water, mango shake
Favorite Fruits : mango, banana
Favorite Cartoon : Dragon Ball Z, The Simpsons
If I were somebody
else, who would it be ? HOMER J. SIMPSON or Son Gokou
DENNIS FERRY
AMA Computer College Second Year Student ( 2001 present )
Saint Jude Institute of Technology Undergraduate / Marine Transportation
AMA Computer Learning Center Computer Systems Design and Programming
Vocational Course: Refrigeration & Airconditioning
Driving
Seminars Attended : ASI Seminar
E-Commerce Seminar
Networking Seminar
Seminar about cabling
Job Experience : Longwood Garden Hotel
Total Accumulated Earnings:
L.G. Hotel : P 11,000 @ 6 months
Computer Skills : Knowledge in Visual Basic, Turbo Pascal, Turbo C, Visual C ++, Visual Foxpro -programming
Knowledge in Web Designing
Knowledge in troubleshooting computer hardware
Other Skills : Dance Instructor / Freelancer
Favorite Food : Pork chop
Favorite Drink : water, Coca-cola, San Miguel light
Favorite Fruits : banana, papaya
Hobbies : body building, table tennis ( 2-time AMA sportsfest champion : 2001-2002 back 2 back ! )
If I were somebody
else, who would it be ? Dwayne " THE ROCK " Johnson
VOLTAIRE A. GARCIA
Lot 10 Block 16 Banahaw Street Phase V Greenwoods, Pasig City
0917-4823737
AMA Computer College Second Year Student ( 2000 present )
Arellano University A.B.H.S. ( 1995-98 )
Seminars Attended : Network Security ( AMA-CC Pasig ) 2002
Age : 21
Sex : Male
Height : 5 4"
Weight : 125 pounds
Computer Skills : Knowledge in Turbo C, Turbo Pascal, Visual Basic - programming
Knowledge in Web Designing
Favorite Food : macaroni, menudo
Favorite Drink : Gatorade
Favorite Fruits : watermelon, banana
Favorite Cartoon : Crayon Shin Chan
If I were somebody
else, who would it be ? Souijiro
THE LORD GOD ALMIGHTY FOR ALL THE BLESSINGS AND ENERGY THAT HE GAVE TO US, TO OUR PARENTS FOR ALL THE SUPPORT, TO OUR INSTRUCTORS AND CLASSMATES OF THE SUBJECT PROLAN SECTION AF, 2ND SEMESTER SCHOOL YEAR 2002-2003. THANKS ALSO TO KHAN MING FOR HELPING US OUT IN THE TURBO PASCAL PROGRAM ..AND ALSO TO BILL GATES FOR MAKING ALL OF THS POSSIBLE, AND ALSO TO NICKLAUS WIRTH !
THANKS ALSO TO OUR SPONSOR :

THANKS ONCE AGAIN AND WE
ENJOYED EACH AND EVERY MINUTE
OF THIS WORK !
ADVERTISEMENT ..

