Class: ChessData::AtLeastCount

Inherits:
Counter
  • Object
show all
Defined in:
lib/chess_data/position-definition.rb

Overview

The AtLeastCount class checks that there are at least n of the named piece on the board.

Instance Attribute Summary

Attributes inherited from Counter

#piece

Instance Method Summary collapse

Methods inherited from Counter

#initialize

Constructor Details

This class inherits a constructor from ChessData::Counter

Instance Method Details

#check(board) ⇒ Object

Returns true if board contains at least n of piece



92
93
94
# File 'lib/chess_data/position-definition.rb', line 92

def check board
  board.count(@piece) >= @n
end