Skip to content

Commit

Permalink
fix(model): change pawn movement and team turn temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
jahrim committed Feb 11, 2023
1 parent 80ff368 commit a2afe54
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Expand Up @@ -64,7 +64,7 @@ object ChessBoard:
this.currentlyPlayingTeam match
case WHITE => this.whitePieces = newTeam
case BLACK => this.blackPieces = newTeam
changePlayingTeam()
// TODO: changePlayingTeam()

private def playingTeam: Map[Position, Piece] = this.currentlyPlayingTeam match
case WHITE => this.whitePieces
Expand Down
12 changes: 9 additions & 3 deletions chess/src/main/scala/io/github/chess/model/Pawn.scala
Expand Up @@ -6,6 +6,8 @@
*/
package io.github.chess.model

import io.github.chess.util.position.PositionExtension.toPosition

/** Represents the particular piece of the pawn. */
trait Pawn extends Piece

Expand All @@ -19,6 +21,10 @@ object Pawn:
def apply(): Pawn = SimplePawn()

private case class SimplePawn() extends Pawn:
override def findMoves(position: Position): Set[Position] = Set(
position.rankUp()
) // TODO Simple set of position
override def findMoves(position: Position): Set[Position] =
List
.iterate(0, 8)(_ + 1)
.flatMap { i => List.iterate(0, 8)(_ + 1).map((i, _).toPosition) }
.filter { _ != position }
.toSet
// TODO Simple set of position
Binary file modified docs/images/architectural-design.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/model-class-diagram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a2afe54

Please sign in to comment.