diff --git a/chess/src/chess/Main.java b/chess/src/chess/Main.java index c69a5d7..6347780 100644 --- a/chess/src/chess/Main.java +++ b/chess/src/chess/Main.java @@ -1,67 +1,3 @@ package chess; -import java.awt.Color; -import java.util.List; -import java.util.Map; -import javax.swing.Action; - -// A chessboard. -class Board { - Map board; -} - -// A location on the board. Measured from top left corner. -class Loc { - int x; - int y; - - Loc(int x, int y) { - this.x = x; - this.y = y; - } - - Loc up() { return new Loc(this.x, this.y - 1); } - Loc down() { return new Loc(this.x, this.y + 1); } - Loc right() { return new Loc(this.x + 1, this.y); } - Loc left() { return new Loc(this.x - 1, this.y); } - Loc up(PieceCol col) { return new Loc(this.x, this.y - 1 * col.n()); } - Loc down(PieceCol col) { return new Loc(this.x, this.y + 1 * col.n()); } - Loc right(PieceCol col) { return new Loc(this.x + 1, this.y * col.n()); } - Loc left(PieceCol col) { return new Loc(this.x - 1, this.y * col.n()); } -} - -// The color a chess piece may assume. -enum PieceCol { - BLACK, - WHITE; - - Color mk() { - return this.equals(BLACK) ? new Color(0, 0, 0) - : new Color(255, 255, 255); - } - - int n() { return this.equals(WHITE) ? 1 : -1; } -} - -// The sort of piece. -enum PieceType { PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING } - -abstract class Piece { - Loc loc; - PieceType type; - PieceCol col; - - Piece(Loc loc, PieceType type, PieceCol col) { - this.loc = loc; - this.type = type; - this.col = col; - } - - List moves() { return List.of(this.loc.up(this.col)); } -} - -class Pawn extends Piece { - Pawn(Loc loc, PieceType type, PieceCol col) { super(loc, type, col); } - - List moves() {} -} +class Main {}