From 187b0bf570552ea636b7f21698e88857dd0079a3 Mon Sep 17 00:00:00 2001 From: Jacob Signorovitch Date: Thu, 24 Apr 2025 14:52:21 -0400 Subject: [PATCH] Updated. --- chess/src/chess/Actor.java | 8 ++++---- chess/src/chess/Board.java | 4 ++-- chess/src/chess/Util.java | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/chess/src/chess/Actor.java b/chess/src/chess/Actor.java index f12fac4..884297d 100644 --- a/chess/src/chess/Actor.java +++ b/chess/src/chess/Actor.java @@ -2,8 +2,8 @@ package chess; // An actor is an entity capable of making descisions on the board. abstract class Actor { - ActorCol col; + Util.Col col; // The color the Actor is acting as. + Boolean inCheck; // Whether the Actor is currently in check. + Boolean canCastle; // Whether the Actor can castle. + Boolean won; // Whether the Actor has won. } - -// The color an Actor may assume. -enum ActorCol { WHITE, BLACK } diff --git a/chess/src/chess/Board.java b/chess/src/chess/Board.java index 8092c8d..e3022bf 100644 --- a/chess/src/chess/Board.java +++ b/chess/src/chess/Board.java @@ -16,8 +16,8 @@ class Coord { // Return coordinates relative to the selected color's position on the // board. White on top, black on bottom. - Coord rel(ActorCol col) { - return col.equals(ActorCol.BLACK) + Coord rel(Util.Col col) { + return col.equals(Util.Col.BLACK) ? new Coord(this.x, Util.boardW - this.y) : this; } diff --git a/chess/src/chess/Util.java b/chess/src/chess/Util.java index fa49665..d36886a 100644 --- a/chess/src/chess/Util.java +++ b/chess/src/chess/Util.java @@ -4,4 +4,7 @@ package chess; class Util { // Width of a chessboard. static int boardW = 8; + + // The color a piece can be. + enum Col { WHITE, BLACK } }