check draw.

This commit is contained in:
2026-02-06 18:59:10 -05:00
parent ba6229c654
commit 56f5ea2615
6 changed files with 63 additions and 10 deletions
@@ -84,7 +84,7 @@ public final class Board {
}
}
protected ResultEnum checkGamePlay() {
public ResultEnum checkGamePlay(BoardButton[] buttons) {
if ((buttons[0].played && buttons[4].played && buttons[8].played)
&&
@@ -166,7 +166,7 @@ public final class Board {
synchronized protected void PlayEventUpdate() {
long delay = 0L;
ResultEnum checkplays = checkGamePlay();
ResultEnum checkplays = checkGamePlay(buttons);
if (ResultEnum.winner == checkplays) {
@@ -0,0 +1,19 @@
package edu.tictactoe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public aspect Referee { // call the plays.
pointcut PlayEventUpdate(): execution(public * edu.tictactoe.Board.*(..));
ResultEnum around(BoardButton[] buttons): execution(public * edu.tictactoe.Board.checkGamePlay(BoardButton[])) && args(buttons) && if(buttons!=null)
{
ResultEnum oval = proceed(buttons);
Logger logger = LoggerFactory.getLogger(Board.class);
logger.info(String.format("Checking Board play: %s ", oval));
return oval;
}
}
@@ -1,8 +0,0 @@
package edu.tictactoe;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class Validator {
}