Class: Egd::PositionFeatureDiscerner
- Inherits:
-
Object
- Object
- Egd::PositionFeatureDiscerner
- Defined in:
- lib/egd/position_feature_discerner.rb
Instance Attribute Summary collapse
-
#end_fen ⇒ Object
readonly
Currently minimal function, Only looks at supplied move and tells whether the position is a check or checkmate.
-
#move ⇒ Object
readonly
Currently minimal function, Only looks at supplied move and tells whether the position is a check or checkmate.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(move:, end_fen:) ⇒ PositionFeatureDiscerner
constructor
A new instance of PositionFeatureDiscerner.
Constructor Details
#initialize(move:, end_fen:) ⇒ PositionFeatureDiscerner
Returns a new instance of PositionFeatureDiscerner.
11 12 13 14 |
# File 'lib/egd/position_feature_discerner.rb', line 11 def initialize(move:, end_fen:) @move = move @end_fen = end_fen end |
Instance Attribute Details
#end_fen ⇒ Object (readonly)
Currently minimal function, Only looks at supplied move and tells whether the position is a check or checkmate.
9 10 11 |
# File 'lib/egd/position_feature_discerner.rb', line 9 def end_fen @end_fen end |
#move ⇒ Object (readonly)
Currently minimal function, Only looks at supplied move and tells whether the position is a check or checkmate.
9 10 11 |
# File 'lib/egd/position_feature_discerner.rb', line 9 def move @move end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/egd/position_feature_discerner.rb', line 16 def call return @features if defined?(@features) @features = {} @features.merge!("check" => true, "checkmate" => true) if move[%r'#\z'] @features.merge!("check" => true) if move[%r'\+\z'] @features end |