Class: ChessData::AtMostCount
- Defined in:
- lib/chess_data/position-definition.rb
Overview
The AtMostCount class checks that there are at most n of the named piece on the board.
Instance Attribute Summary
Attributes inherited from Counter
Instance Method Summary collapse
-
#check(board) ⇒ Object
Returns true if board contains at most n of piece.
Methods inherited from Counter
Constructor Details
This class inherits a constructor from ChessData::Counter
Instance Method Details
#check(board) ⇒ Object
Returns true if board contains at most n of piece
101 102 103 |
# File 'lib/chess_data/position-definition.rb', line 101 def check board board.count(@piece) <= @n end |