Skip to content

Commit

Permalink
Merge pull request #40 from kwollw/ostseeschach
Browse files Browse the repository at this point in the history
Update piece.rb
  • Loading branch information
jnccd authored Oct 2, 2021
2 parents 1457123 + 379928c commit 773fba8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/software_challenge_client/piece.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Ein Spielstein mit Ausrichtung, Koordinaten und Farbe
class Piece
include Constants

# @!attribute [rw] Color
# @return [Color]
attr_accessor :color
Expand Down Expand Up @@ -53,6 +55,7 @@ def target_coords
end

coords.map{ |x| x + position }.to_a
coords.map{ |x| x + position }.select{ |c| c.x >= 0 && c.y >=0 && c.x < BOARD_SIZE && c.y < BOARD_SIZE}.to_a
end

def ==(other)
Expand Down

0 comments on commit 773fba8

Please sign in to comment.