Java Reference
In-Depth Information
if
( isGameOver () )
{
return
;
computerMove () ;
repaint () ;
if
( isGameOver () )
{
return
;
}
}
}
}
}
}
}
class
Square
extends
Rectangle2D .Double
{
private boolean
isX =
false
;
private boolean
isO =
false
;
public boolean
isCharacter(
char
c)
{
if
(c ==
'x'
)
{
return
isX;
if
(c ==
'o'
)
{
return
isO;
return false
;
}
public void
placeCharacter(
char
c)
{
if
(c ==
'x'
)
{
isX =
true
;
if
(c ==
'o'
)
{
isO =
true
;
}
}
public void
clear()
{
isX =
false
;
isO =
false
;
}
public boolean
hasValue()
{
return
(isX
||
isO) ;
}
public
Square(
double
x,
double
y,
double
dx ,
double
dy)
{
super
(x, y, dx, dy) ;
}
public void
draw(Graphics2D g2 , Image xImage , Image oImage)
{
g2 . draw(
super
. getBounds2D() ) ;
if
(isX)
{