Add to Favorites    Make Home Page 1601 Online  
 Language Categories  
 Our Services  

Home » Pascal Home » Pascal Projects Home » Tic Tac Toe Game implemented in Pascal.

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Tic Tac Toe Game implemented in Pascal.
Description
Category Pascal » Pascal Projects
Hits 392424
Code Select and Copy the Code
{ Description: Tic Tac Toe } Program TIC_TAC_TOE; Uses Graph; Const Directory='C:TPBGI'; Cross=3; Zero=4; Blank=2; Type Myarray=Array[1..3,1..3] Of Integer; Array1=Array[1..3,1..3] Of Char; Var Driver :Integer; Mode :Integer; A1 :Myarray; Ar1 :Array1; X1 :Integer; N :Integer; A :Integer; Y :Integer; Z :Integer; Success :Boolean; Position :Integer; I :Integer; Choice :Integer; {************************************************************} Procedure Drawboard; Begin Initgraph(Driver,Mode,Directory); Setbkcolor(DarkGray); Setcolor (Blue); Cleardevice ; Line(225,25,225,300); Line(400,25,400,300); Line(100,125,500,125); Line(100,200,500,200); End; {************************************************************} Procedure Check; Begin Success:=False; If ((A1[1,1]*A1[2,2]*A1[3,3])=64) Then Begin Success:=True; I:=1; End; If ((A1[1,3]*A1[2,2]*A1[3,1])=64) Then Begin Success:=True; I:=1; End; If ((A1[1,1]*A1[2,2]*A1[3,3])=27) Then Begin Success:=True; I:= 2; End; If ((A1[1,3]*A1[2,2]*A1[3,1])=27) Then Begin Success:=True; I:=2; End; If ((A1[1,1]*A1[1,2]*A1[1,3])=64) or ((A1[2,1]*A1[2,2]*A1[2,3])=64) Or ((A1[3,1]*A1[3,2]*A1[3,3]=64)) Then Begin Success:=True; I:=1; End; If ((A1[1,1]*A1[1,2]*A1[1,3]=27))Or ((A1[2,1]*A1[2,2]*A1[2,3]=27))Or ((A1[3,1]*A1[3,2]*A1[3,3]=27)) Then Begin Success:=True; I:= 2; End; If ((A1[1,1]*A1[2,1]*A1[3,1]=64)) or ((A1[1,2]*A1[2,2]*A1[3,2]=64)) Or ((A1[1,3]*A1[2,3]*A1[3,3]=64)) Then Begin Success:=True; I:=1; End; If ((A1[1,1]*A1[2,1]*A1[3,1]=27)) or ((A1[1,2]*A1[2,2]*A1[3,2]=27)) or ((A1[1,3]*A1[2,3]*A1[3,3]=27))Then Begin Success:=True; I:=2; End; End; {************************************************************} Procedure Check2; Begin Success:=False; If (Ar1[1,1]='#') And(Ar1[2,2]='#') and (Ar1[3,3]='#') Then Begin Success:=True; I:=1; End ; If (Ar1[1,3]='#') And (Ar1[2,2]='#') And (Ar1[3,1]='#') Then Begin Success:=True; I:=1; End ; If (Ar1[1,1] ='*') and (Ar1[2,2]='*') And (Ar1[3,3]='*') Then Begin Success:=True; I:=2; End ; If (Ar1[1,3]='*') And (Ar1[2,2]='*') And (Ar1[3,1]='*') Then Begin Success:=True; I:=2; End ; If ((Ar1[1,1]='#') And (Ar1[1,2]='#') And (Ar1[1,3]='#')) or ((Ar1[2,1]='#') And (Ar1[2,2]='#') And (Ar1[2,3]='#')) Or ((Ar1[3,1]='#') And (Ar1[3,2]='#') And (Ar1[3,3]='#')) Then Begin Success:=True; I:=1; End ; If ((Ar1[1,1]='*') And (Ar1[1,2]='*') And (Ar1[1,3]='*')) or ((Ar1[2,1]='*') And (Ar1[2,2]='*') And (Ar1[2,3]='*')) Or ((Ar1[3,1]='*') And (Ar1[3,2]='*') And (Ar1[3,3]='*')) Then Begin Success:=True; I:=2; End ; If ((Ar1[1,1]='#') And (Ar1[2,1]='#') And (Ar1[3,1]='#')) or ((Ar1[1,2]='#') And (Ar1[2,2]='#') And (Ar1[3,2]='#')) Or ((Ar1[1,3]='#') And (Ar1[2,3]='#') And (Ar1[3,3]='#')) Then Begin Success:=True; I:=1; End ; If ((Ar1[1,1]='*') And (Ar1[2,1]='*') And (Ar1[3,1]='*')) or ((Ar1[1,2]='*') And (Ar1[2,2]='*') And (Ar1[3,2]='*')) Or ((Ar1[1,3]='*') And (Ar1[2,3]='*') And (Ar1[3,3]='*')) Then Begin Success:=True; I:=2; End ; End; {************************************************************} Procedure UserGuide; Begin Writeln; Writeln (' ','HOW TO PLAY TIC TAC TOE'); Writeln (' ','======================='); Writeln; Writeln ('This Game Is Based On The Following Rules'); Writeln; Write ('1. The Numbers In Each Box Represents Its Position.'); Write ('To Play Press Your Desired Number From The Keyboard to Place Your Symbol In That Box.'); Write ('And Then Press Enter.'); Writeln; Writeln; Write ('2. No User Is Allowed To Take More Than One Turn Or Use The Same Position Twice'); Write (' If He Does So His Turn Will Be Cancelled.'); Writeln; End; {************************************************************} Procedure Display (Ar :Array1); Begin Drawboard; For X1:=1 to 3 do Begin Writeln; Writeln; Writeln; For Y:=1 to 3 do Write (' ',Ar[X1,Y]); Writeln; Writeln; Writeln; End; End; {************************************************************} Procedure Twoplayer; Begin A:=49; For X1:= 1 to 3 do For Y:=1 to 3 do Begin Ar1[X1,Y]:=Chr(A); A:=A+1; End; Display (Ar1); Writeln ('Player 1 must play with #'); Writeln('Player 2 must play with *'); Repeat Writeln ('Enter Position'); Readln (position); Case Position of 1: Begin If (Ar1[1,1]='#') or (Ar1[1,1]='*') Then Writeln('The Position is Already Occupied') Else Ar1[1,1]:='*'; End; 2: Begin If (AR1[1,2]='#') or (Ar1[1,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[1,2]:='*'; End; 3: Begin If (Ar1[1,3]='#') or (Ar1[1,3]='*')Then Writeln('The Position is Already Occupied') Else Ar1[1,3]:='*'; End; 4: Begin If (Ar1[2,1]='#') or (Ar1[2,1]='*')Then Writeln('The Position is Already Occupied') Else Ar1[2,1]:='*'; End; 5: Begin If (Ar1[2,2]='#') or (Ar1[2,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[2,2]:='*'; End; 6: Begin If (Ar1[2,3]='#') or (Ar1[2,3]='*' )THen Writeln('The Position is Already Occupied') Else Ar1[2,3]:='*'; End; 7: Begin If (Ar1[3,1]='#') or (Ar1[3,1]='*')THen Writeln('The Position is Already Occupied') Else Ar1[3,1]:='*'; End; 8: Begin If (Ar1[3,2]='#') or (Ar1[3,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[3,2]:='*'; End; 9: Begin If (Ar1[3,3]='#') or (Ar1[3,3]='*')Then Writeln('The Position is Already Occupied') Else Ar1[3,3]:='*'; End; End; Drawboard; Display (Ar1); Check2; For X1:= 1 to 3 do For Y :=1 to 3 do Begin If (Ar1[X1,Y]='#') Or (Ar1[X1,Y]='*') Then N:=N+1; End; If N=9 Then Success:=True; N:=0; If Success=True Then Exit; Writeln ('Enter Position'); Readln (position); Case Position of 1: Begin If (Ar1[1,1]='#') or (Ar1[1,1]='*')Then Writeln('The Position is Already Occupied') Else Ar1[1,1]:='#'; End; 2: Begin If (AR1[1,2]='#') or (Ar1[1,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[1,2]:='#'; End; 3: Begin If (Ar1[1,3]='#') or (Ar1[1,3]='*')Then Writeln('The Position is Already Occupied') Else Ar1[1,3]:='#'; End; 4: Begin If (Ar1[2,1]='#') or (Ar1[2,1]='*')Then Writeln('The Position is Already Occupied') Else Ar1[2,1]:='#'; End; 5: Begin If (Ar1[2,2]='#') or (Ar1[2,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[2,2]:='#'; End; 6: Begin If (Ar1[2,3]='#') or (Ar1[2,3]='*') THen Writeln('The Position is Already Occupied') Else Ar1[2,3]:='#'; End; 7: Begin If (Ar1[3,1]='#') or (Ar1[3,1]='*')THen Writeln('The Position is Already Occupied') Else Ar1[3,1]:='#'; End; 8: Begin If (Ar1[3,2]='#') or (Ar1[3,2]='*')Then Writeln('The Position is Already Occupied') Else Ar1[3,2]:='#'; End; 9: Begin If (Ar1[3,3]='#') or (Ar1[3,3]='*')Then Writeln('The Position is Already Occupied') Else Ar1[3,3]:='#'; End; End; Display (Ar1); Check2; For X1:= 1 to 3 do For Y :=1 to 3 do Begin If (Ar1[X1,Y]='#') Or (Ar1[X1,Y]='*') Then N:=N+1; End; If N=9 Then Success:=True; N:=0; Until (success=True); End; {************************************************************} Procedure Singleplayer; Begin For X1:=1 to 3 do Begin For Y:=1 to 3 do A1[X1,Y]:=Blank; End; A:=49; For X1:=1 to 3 do Begin For Y:=1 to 3 do Begin Ar1[X1,Y]:=Chr (A) ; A:=A+1; End; End; Drawboard; Display (Ar1); Writeln ('Your Symbol Is *'); Repeat Writeln ('Enter Position'); Readln (position); Case Position of 1: Begin If (Ar1[1,1]='#') or (Ar1[1,1]='*') then Writeln('This position has been occupied') Else Begin Ar1[1,1]:='*'; If Ar1[1,1]='*' Then A1[1,1]:=3; End; End; 2: Begin If (Ar1[1,2]='#') or (Ar1[1,2]='*') then Writeln('This position has been occupied') Else Begin Ar1[1,2]:='*'; If Ar1[1,2]='*' Then A1[1,2]:=3; End; End; 3: Begin If (Ar1[1,3]='#') or (Ar1[1,3]='*') then Writeln('This position has been occupied') Else Begin Ar1[1,3]:='*'; If Ar1[1,3]='*' Then A1[1,3]:=3; End; End; 4: Begin If (Ar1[2,1]='#') or (Ar1[2,1]='*') then Writeln('This position has been occupied') Else Begin Ar1[2,1]:='*'; If Ar1[2,1]='*' Then A1[2,1]:=3; End; End; 5: Begin If (Ar1[2,2]='#') or (Ar1[2,2]='*') then Writeln('This position has been occupied') Else Begin Ar1[2,2]:='*'; If Ar1[2,2]='*' Then A1[2,2]:=3; End; End; 6: Begin If (Ar1[2,3]='#') or (Ar1[2,3]='*') then Writeln('This position has been occupied') Else Begin Ar1[2,3]:='*'; If Ar1[2,3]='*' Then A1[2,3]:=3; End; End; 7: Begin If (Ar1[3,1]='#') or (Ar1[3,1]='*') then Writeln('This position has been occupied') Else Begin Ar1[3,1]:='*'; If Ar1[3,1]='*' Then A1[3,1]:=3; End; End; 8: Begin If (Ar1[3,2]='#') or (Ar1[3,2]='*') then Writeln('This position has been occupied') Else Begin Ar1[3,2]:='*'; If Ar1[3,2]='*' Then A1[3,2]:=3; End; End; 9: Begin If (Ar1[3,3]='#') or (Ar1[3,3]='*') then Writeln('This position has been occupied') Else Begin Ar1[3,3]:='*'; If Ar1[3,3]='*' Then A1[3,3]:=3; End; End; End; Check; If Success=True Then Begin Exit; End; If ((A1[1,1])*(A1[1,2])*(A1[1,3]))=32 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero; Ar1[1,2]:='#'; End Else Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End; End; End; End Else Begin If ((A1[2,1])*(A1[2,2])*(A1[2,3]))=32 Then Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero; Ar1[2,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End; End; End; End Else Begin If ((A1[3,1])*(A1[3,2])*(A1[3,3]))=32 Then Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero; Ar1[3,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,1])*(A1[3,1]))=32 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero ; Ar1[2,1]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,2])*(A1[2,2])*(A1[3,2]))=32 Then Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero; Ar1[1,2]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,3])*(A1[3,3]))=32 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero ; Ar1[1,3]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,2])*(A1[3,3]))=32 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#' ; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#' ; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,2])*(A1[3,1]))=32 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#' ; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[1,2])*(A1[1,3]))=18 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero ; Ar1[1,2]:='#'; End Else Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End; End; End; End Else Begin If ((A1[2,1])*(A1[2,2])*(A1[2,3]))=18 Then Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero ; Ar1[2,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End; End; End; End Else Begin If ((A1[3,1])*(A1[3,2])*(A1[3,3]))=18 Then Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero ; Ar1[3,1]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero ; Ar1[3,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,1])*(A1[3,1]))=18 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero ; Ar1[1,1]:='#'; End Else Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero ; Ar1[2,1]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,2])*(A1[2,2])*(A1[3,2]))=18 Then Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero; Ar1[1,2]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero; Ar1[3,2]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,3])*(A1[3,3]))=18 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,2])*(A1[3,3]))=18 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End End; End; End Else Begin If ((A1[1,3])*(A1[2,2])*(A1[3,1]))=18 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End End; End; End Else Begin If ((A1[1,1])*(A1[1,2])*(A1[1,3]))=16 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero ; Ar1[1,1]:='#'; End Else Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero; Ar1[1,2]:='#'; End Else Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End; End; End; End Else Begin If ((A1[2,1])*(A1[2,2])*(A1[2,3]))=16 Then Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero; Ar1[2,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End; End; End; End Else Begin If ((A1[3,1])*(A1[3,2])*(A1[3,3]))=16 Then Begin If A1[3,1]=Blank Then Begin Ar1[3,1]:='#'; A1[3,1]:=Zero End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero ; Ar1[3,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End End; End; End Else Begin If ((A1[1,1])*(A1[2,1])*(A1[3,1]))=16 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero ; Ar1[2,1]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,2])*(A1[2,2])*(A1[3,2]))=16 Then Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero ; Ar1[1,2]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero; Ar1[3,2]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,3])*(A1[3,3]))=16 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero ; Ar1[2,3]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,2])*(A1[3,3]))=16 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero ; Ar1[1,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,2])*(A1[3,1]))=16 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[1,2])*(A1[1,3]))=8 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero ; Ar1[1,1]:='#'; End Else Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero ; Ar1[1,2]:='#'; End Else Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End; End; End; End Else Begin If ((A1[2,1])*(A1[2,2])*(A1[2,3]))=8 Then Begin If A1[2,1]=Blank Then Begin A1[2,1]:=Zero ; Ar1[2,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero ; Ar1[2,2]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero; Ar1[2,3]:='#'; End; End; End; End Else Begin If ((A1[3,1])*(A1[3,2])*(A1[3,3]))=8 Then Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero ; Ar1[3,1]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero ; Ar1[3,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,1])*(A1[3,1]))=8 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero; Ar1[1,1]:='#'; End Else Begin If A1[2,1]=Blank Then Begin A1[2,1]:=zero; Ar1[2,1]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End Else Begin If ((A1[1,2])*(A1[2,2])*(A1[3,2]))=8 Then Begin If A1[1,2]=Blank Then Begin A1[1,2]:=Zero; Ar1[1,2]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,2]=Blank Then Begin A1[3,2]:=Zero; Ar1[3,2]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,3])*(A1[3,3]))=8 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero ; Ar1[1,3]:='#'; End Else Begin If A1[2,3]=Blank Then Begin A1[2,3]:=Zero ; Ar1[2,3]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,1])*(A1[2,2])*(A1[3,3]))=8 Then Begin If A1[1,1]=Blank Then Begin A1[1,1]:=Zero ; Ar1[1,1]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,3]=Blank Then Begin A1[3,3]:=Zero; Ar1[3,3]:='#'; End; End; End; End Else Begin If ((A1[1,3])*(A1[2,2])*(A1[3,1]))=8 Then Begin If A1[1,3]=Blank Then Begin A1[1,3]:=Zero; Ar1[1,3]:='#'; End Else Begin If A1[2,2]=Blank Then Begin A1[2,2]:=Zero; Ar1[2,2]:='#'; End Else Begin If A1[3,1]=Blank Then Begin A1[3,1]:=Zero; Ar1[3,1]:='#'; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; End; Display (Ar1); Check; For X1:= 1 to 3 do For Y :=1 to 3 do Begin If (A1[X1,Y]=Zero) Or (A1[X1,Y]=Cross) Then N:=N+1; End; If N=9 Then Success:=True; N:=0; Until (success=True); End; {************************************************************} Begin Initgraph (Driver,Mode,Directory); Cleardevice; Repeat I:=0; UserGuide; Writeln; Writeln; Writeln ('Enter 1 For Singleplayer'); Writeln; Writeln ('************************'); Writeln; Writeln( 'Enter 2 for Twoplayer'); Writeln; Writeln ('************************'); Writeln; Writeln('Enter 3 to Exit'); Writeln; Writeln ('************************'); Writeln; Readln (Choice); Cleardevice; If Choice=1 Then Begin Singleplayer; If (I=2) Then Writeln ('You Win'); If (I=1) Then Writeln ('Computer Wins'); If (I=0) Then Writeln ('Game Drawn'); End; If Choice=2 Then Begin Twoplayer; If I=1 Then Writeln ('Player 1 Wins'); If I=2 Then Writeln ('Player 2 Wins'); If (I=0) Then Writeln ('Game Drawn'); End; Until Choice=3; End.

Related Source Codes

Script Name Author
Calendar date to day number and back Nicky McLean
Matrix Multiple Cirruse Salehnasab
Function Power Recursive Cirruse Salehnasab
swim brian colston
tetris (Mini Project) mehdi farrokhzad
Macsi - space fighting game. Macsi P�ter
Recursive Monkey Puzzle Solution - Project Maxim C.L. Wrne
Maze Game Project In Pascal Mahmood
Excellent Rat in a Maze Program. VyomWorld
A car game. You have to drive the car in such a way that you dont strike a barrier on the road. VyomWorld
Student Database Information System. VyomWorld
Game to Gain more blocks by drawing appropriate lines from correct places(dots). VyomWorld
To Find The Coinage Of The Amount Entered. VyomWorld
Randomizes two 3x3 arrays and indicates the numbers whih are common in both the arrays otherwise an cross 'x' is shown instead. VyomWorld
Program that checks the space on drive a: and also gives a graphical representation of memory. VyomWorld

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=169


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review