Skip to content

Commit

Permalink
feat: add chess board situation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jahrim committed Feb 27, 2023
1 parent 68bcaef commit 9eb1475
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
@@ -0,0 +1,9 @@
package io.github.chess.model.situations
import io.github.chess.model.ChessGameStatus

/**
* The "check" situation in a chess game is when the king can be captured
* by the opponent in the next turn.
*/
class Check extends ChessBoardSituation:
override def checkOn(state: ChessGameStatus): Boolean = ???
@@ -0,0 +1,10 @@
package io.github.chess.model.situations

import io.github.chess.model.ChessGameStatus

/**
* The "checkmate" situation in a chess game is when the king is always captured
* by the opponent in the next turn.
*/
class CheckMate extends ChessBoardSituation:
override def checkOn(state: ChessGameStatus): Boolean = ???
@@ -0,0 +1,13 @@
package io.github.chess.model.situations

import io.github.chess.model.ChessGameStatus

/**
* Situation in a game of chess (i.e.: check, checkmate, stalemate...).
*/
trait ChessBoardSituation:
/**
* @param state the specified state of the game
* @return true if the game in the specified state is in this situation, false otherwise.
*/
def checkOn(state: ChessGameStatus): Boolean
@@ -0,0 +1,10 @@
package io.github.chess.model.situations

import io.github.chess.model.{ChessBoard, ChessGameStatus}

/**
* The "stalemate" situation is when the current player cannot move any
* pieces, but there's no checkmate.
*/
class Stalemate extends ChessBoardSituation:
override def checkOn(state: ChessGameStatus): Boolean = ???

0 comments on commit 9eb1475

Please sign in to comment.