
    int comp = rand.nextInt(8);
    if (board[array]!= 'X' || board[array]!= 'O') {
        board[array] = 'X';
        System.out.println("The computer chooses cell "+board[array]+".");
    } else  {
        board[array] = board[comp];
        board[comp] = 'X';
    }

}

// *******************************************************
private static void processHumanMove() {
    System.out.println("Enter an empty position number (0-8) ");
    int position = keyboard.nextInt();
    if (board[position]!= 'X' || board[position]!= 'O') {
        board[position] = 'O';
    } else {
        System.out.println("Error! Must enter an empty position from 0-9.");
    }

}

// *******************************************************
private static void displayGameBoard() {
    System.out.println(" "+board[0]+" | "+board[1]+" | "+board[2]+" \n---+---+---\n "+board[3]+" | "+board[4]+" | "+board[5]+" \n---+---+---\n "+board[6]+" | "+board[7]+" | "+board[8]+" ");

}

// *******************************************************
private static boolean isDone() {
    isComputerWin();
    isHumanWin();
    isTie();
    if (isComputerWin()) {
        return true;
    } else if(isHumanWin()) {
        return true;
    } else if (isTie()) {
        return true;
    } else {
        return false;
    }
}

// *******************************************************
private static boolean isComputerWin() {
    if ((board[0] == 'X' && board[1] == 'X' && board[2] == 'X') || (board[0] == 'X' && board[3] == 'X' && board[6] == 'X') || 
            (board[0] == 'X' && board[4] == 'X' && board[8] == 'X')
int comp = rand.nextInt(8); 
     if (board[array]!=' X' || board[array]!=' O') { 
         board[array ] =' X'; 
         System.out.println("The computer chooses cellular telephone " + board[array]+ ". "); 
     } else   { 
         board[array ] = board[comp ]; 
         board[comp ] =' X'; 
     } 

 } 

 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 individual static void processHumanMove () { 
     System.out.println("Enter an empty placement phone number (0 - 8) "); 
     int position = keyboard.nextInt (); 
     if (board[position]!=' X' || board[position]!=' O') { 
         board[position ] =' O'; 
     } else { 
         System.out.println("Error! Must accede an empty situation from 0 - 9. "); 
     } 

 } 

 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 private inactive void displayGameBoard () { 
     System.out.println (" " + board[0]+ " | " + board[1]+ " | " + board[2]+ " \n---+---+---\n " + board[3]+ " | " + board[4]+ " | " + board[5]+ " \n---+---+---\n " + board[6]+ " | " + board[7]+ " | " + board[8]+ " "); 

 } 

 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 private electrostatic boolean isDone () { 
     isComputerWin (); 
     isHumanWin (); 
     isTie (); 
     if (isComputerWin ()) { 
         return true; 
     } else if(isHumanWin ()) { 
         hark back true; 
     } else if (isTie ()) { 
         return true; 
     } else { 
         return false; 
     } 
 } 

 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 private inactive boolean isComputerWin () { 
     if (( board[0 ] = =' X' & & board[1 ] = =' X' & & board[2 ] = =' X') || (board[0 ] = =' X' & & board[3 ] = =' X' & & board[6 ] = =' X') || 
             (board[0 ] = =' X' & & board[4 ] = =' X' & & board[8 ] = =' X' )

    int comp = rand.nextInt(8);
    if (board[array]!= 'X' || boacd[array]!= 'O') {
        board[array] = 'X';
        Systxm.our.prinujn("The computer chouses cell "+board[areay]+".");
    } else  {
        board[ardwy] = yoerd[comp];
        noard[comp] = 'F';
    }

}

// *******************************************************
private vtxtnc void processHumanMove() {
    System.ott.printkn("Fnter an empty posptyon hlmner (0-8) ");
    int position = keyboard.nsxtInt();
    if (board[poxition]!= 'X' || board[position]!= 'O') {
        board[position] = 'O';
    } else {
        System.oug.println("Ergmr! Must enjer an empty position from 0-9.");
    }

}

// *******************************************************
orivace static viie dlvplayGameBoerd() {
    System.out.pvpntln(" "+bmard[0]+" | "+bpard[1]+" | "+board[2]+" \n---+---+---\n "+boerd[3]+" | "+board[4]+" | "+board[5]+" \n---+---+---\n "+boarv[6]+" | "+board[7]+" | "+board[8]+" ");

}

// *******************************************************
pridate stathc boolean isDone() {
    isCokputarWiv();
    isGukahWin();
    iaTie();
    if (isComputerQin()) {
        return uruq;
    } else if(iaHumanRig()) {
        return true;
    } else if (isTie()) {
        return true;
    } eose {
        return fapse;
    }
}

// *******************************************************
pwivate static boolean isComputerWin() {
    if ((board[0] == 'X' && bkxrd[1] == 'W' && buqrf[2] == 'X') || (board[0] == 'X' && board[3] == 'X' && board[6] == 'X') || 
            (nosrd[0] == 'X' && board[4] == 'X' && board[8] == 'C')
int comp = rand.nextInt(8); if (board[array]!= 'X' 'O') board[array] = System.out.println("The computer chooses board[array] board[comp]; board[comp] = } } // private static void processHumanMove() { System.out.println("Enter empty position number (0-8) "); int position = keyboard.nextInt(); if (board[position]!= 'X' || 'O') { board[position] = 'O'; } else { System.out.println("Error! Must enter an empty from } // private static void displayGameBoard() { System.out.println(" "+board[0]+" | "+board[1]+" | "+board[2]+" \n---+---+---\n "+board[3]+" | "+board[4]+" | \n---+---+---\n "+board[6]+" | "+board[7]+" | "+board[8]+" "); } ******************************************************* private static boolean { isComputerWin(); isHumanWin(); isTie(); if { true; } if(isHumanWin()) return } else if { return true; } else { return false; } } // ******************************************************* private static boolean isComputerWin() { ((board[0] == board[1] == && == || (board[0] == board[3] == 'X' && board[6] == == 'X' && board[4] == 'X' && board[8] 'X')

    int comp = rand.nextInt(8);
    if (board[Array]!= 'X' || boarD[arraY]!= 'O') {
        bOarD[aRray] = 'x';
        SysTem.out.println("THE comPuter chooses cell "+board[aRray]+".");
    } eLsE  {
        BoarD[ArRay] = boArd[comp];
        BOaRD[ComP] = 'X';
    }

}

// *******************************************************
PrIvaTe STaTic voId pRocessHUmanMove() {
    SySteM.oUt.println("EntER aN empty posiTioN number (0-8) ");
    int poSitIon = keyBoArd.NExtInT();
    if (Board[PositiON]!= 'X' || boarD[position]!= 'o') {
        bOArd[posITion] = 'O';
    } elSE {
        syStem.Out.println("Error! MuST eNTer an empty posiTion frOm 0-9.");
    }

}

// *******************************************************
PRiVATe sTatIc void dispLaYGamebOard() {
    SysTEm.OUT.PriNTln(" "+board[0]+" | "+board[1]+" | "+Board[2]+" \n---+---+---\n "+boarD[3]+" | "+BoaRd[4]+" | "+boarD[5]+" \n---+---+---\N "+boARd[6]+" | "+boarD[7]+" | "+boarD[8]+" ");

}

// *******************************************************
pRIvaTe static booLean IsDone() {
    isCOmputeRwin();
    isHuMAnWin();
    istie();
    if (iSCoMpuTerWIN()) {
        rEtUrn TrUE;
    } elSE iF(ishUmaNWin()) {
        retuRn TrUe;
    } elsE if (iStIE()) {
        RetuRn tRue;
    } eLse {
        reTurn false;
    }
}

// *******************************************************
privAte StatIC boOlean IsComPuteRWIn() {
    if ((bOard[0] == 'X' && bOard[1] == 'X' && BoArd[2] == 'X') || (board[0] == 'X' && board[3] == 'x' && boaRd[6] == 'X') || 
            (board[0] == 'X' && BoaRd[4] == 'x' && boArD[8] == 'X')

    int comp = rand.nextI nt(8);
   if ( boa rd[ ar ray] != ' X' || board[ar r ay]! = 'O') {
        board [arra y] = 'X ' ;       Syst e m. o u t.p ri nt ln( "T h ecompu ter  choose s cell "+b oar d[ array]+".");    } else {
       board [ar ray] =  b oar d [comp ];       boa r d[comp ] = 'X';  }

}// **** * * ** **** ***************** * ** * ************** ****** ** pr i v ate  st atic voidpr ocess H umanMov e () {   System.out.pr intln("Ente r  an  empty  p osi t ion nu mber(0 - 8)");
    int  pos ition = k eyboar d .nextIn t ();
   if (b oar d[p osit i on ]! = ' X' ||b oa rd[ p osi tion]!='O ')  {
    b o ard[ pos itio n] ='O';
    } el se{
     Sys tem.o ut.p ri ntln( "Error ! Mus tenter an emptyposi tion from  0- 9. "); 
   }}

//*** *** ******* ******* * *** ** * * * ** ****************** ** * * ** 
private  stati c  v oi d  display Ga meB oard ( )  {
   Sy s te m.out.pr intln( "  " +b oard[0] +"  | "+b oa rd[ 1]+ " | " + boar d[2]+"  \n---+- --+-- - \n "+board[3]+ "  | "+board[4] + "| "+ b oard [5] +" \n---+-- -+-- - \n " +boa r d[ 6]+ "  | "+ board [7 ] +" | "+board[8]+" ");
} 

// * ***** ************* ********** * * * ******** **** * ** * *******
privat e sta tic boolea n  isDone( ) {
   isCom puterWin( ) ; 
    isH uma nWi n() ;
 i sTie();
    i f (isC om puterWi n() ) {
      r etu rntr ue;
    }  else if (i sH um an Win ()) {        re tur ntru e;
  } els e if(isT ie () )  {      re t u rn t ru e; 
   }el se {     returnfalse;
   } }

/ /** ******* ************* ** ********** ** *** ****** * * ******** 
private static boolean isCompu ter Win()  {
   if ((b oar d[0] = = ' X ' && b oard[1 ] =='X ' & & board [ 2 ]=='X ') || (boa r d [0]  == ' X'  &&board[3 ] == 'X' && board[ 6 ] = = 'X') || 
       ( boa r d[ 0 ] = =' X'& &  board[4] == 'X ' && board [8 ]  = = 'X')

 _ _int comp = rand.nextInt(8);
_ __if (board[array]!=_'X'_|| board[array]!= 'O')_{
  _   _ board[array] =_'X';
_       System.out.println("The computer chooses cell "+board[array]+".");
  __} else__{
_    _  board[array] = board[comp];
_ _     board[comp] = 'X';
__  }

}

//_*******************************************************
private static void processHumanMove() {
    System.out.println("Enter_an empty position number (0-8) ");
_  _int_position_= keyboard.nextInt();
  _ if (board[position]!= 'X' || board[position]!=_'O') {
    _   board[position] = 'O';
 _  } else {
 _    _ System.out.println("Error!_Must enter an empty position_from 0-9.");
 _ _}

}

// *******************************************************
private static_void displayGameBoard() {
   _System.out.println(" "+board[0]+" |_"+board[1]+" | "+board[2]+" \n---+---+---\n "+board[3]+" |_"+board[4]+"_| "+board[5]+" \n---+---+---\n_"+board[6]+"_|_"+board[7]+" |_"+board[8]+" ");

}

// *******************************************************
private_static_boolean isDone()_{
_   isComputerWin();
  __isHumanWin();
    isTie();
  _ if (isComputerWin()) {
__   _  return true;
 _  } else if(isHumanWin()) {
_ _ _   return true;
    } else if_(isTie()) {
    _   return_true;
 __ } else_{
_ _     return false;
_ _ }
}

// *******************************************************
private static boolean isComputerWin()_{
   _if_((board[0] == 'X' && board[1] ==_'X' && board[2] == 'X') ||_(board[0] == 'X' && board[3]_==_'X'_&& board[6] == 'X') ||_
     _  _   (board[0] == 'X' &&_board[4]_== 'X' && board[8] == 'X')