Added classes for chess.
This commit is contained in:
9
chess/src/chess/Actor.java
Normal file
9
chess/src/chess/Actor.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package chess;
|
||||
|
||||
// An actor is an entity capable of making descisions on the board.
|
||||
abstract class Actor {
|
||||
ActorColor color;
|
||||
}
|
||||
|
||||
// The color an Actor may assume.
|
||||
enum ActorColor { WHITE, BLACK }
|
11
chess/src/chess/Board.java
Normal file
11
chess/src/chess/Board.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package chess;
|
||||
import java.util.Map;
|
||||
|
||||
class Board {
|
||||
Map<Coord, Piece> board;
|
||||
}
|
||||
|
||||
// Measured from top left.
|
||||
class Coord {
|
||||
int x, y;
|
||||
}
|
6
chess/src/chess/Game.java
Normal file
6
chess/src/chess/Game.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package chess;
|
||||
|
||||
class Game {
|
||||
Actor white;
|
||||
Actor black;
|
||||
}
|
6
chess/src/chess/Piece.java
Normal file
6
chess/src/chess/Piece.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package chess;
|
||||
|
||||
// A chess piece.
|
||||
abstract class Piece {}
|
||||
|
||||
class Pawn extends Piece {}
|
4
chess/src/chess/Player.java
Normal file
4
chess/src/chess/Player.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package chess;
|
||||
|
||||
// A human-controlled Actor.
|
||||
class Player extends Actor {}
|
Reference in New Issue
Block a user