-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: solve pawns not being able to capture on File H
- Loading branch information
1 parent
7523a32
commit 6a0f937
Showing
3 changed files
with
21 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
chess/src/main/scala/io/github/chess/model/rules/prolog/InsideBoardFilterRule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* MIT License | ||
* Copyright (c) 2023 Cesario Jahrim Gabriele & Derevyanchenko Maxim & Felice Mirko & Kentpayeva Madina | ||
* | ||
* Full license description available at: https://github.com/jahrim/PPS-22-chess/blob/master/LICENSE | ||
*/ | ||
package io.github.chess.model.rules.prolog | ||
|
||
import io.github.chess.model.Position | ||
|
||
/** | ||
* Represents an alternative rule to [[InsideBoardRule]] rule that limits | ||
* the positions inside the board by filtering. | ||
*/ | ||
trait InsideBoardFilterRule(private val maxX: Int = 7, private val maxY: Int = 7) | ||
extends PrologRule: | ||
|
||
abstract override def findPositions(position: Position): LazyList[(Int, Int)] = | ||
super.findPositions(position).filter((x, y) => x >= 0 && x <= maxX && y >= 0 && y <= maxY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters