Class: RGnuchess::Move
- Inherits:
-
Object
- Object
- RGnuchess::Move
- Defined in:
- lib/rgnuchess.rb
Overview
A Move represents a possible chess move, relative to a given chess position. (Gnuchess gives simple moves, e.g. βe4β or βNa6β, so the same move string may mean something else with a different board position.)
Instance Attribute Summary collapse
-
#check ⇒ Object
Returns the value of attribute check.
-
#mate ⇒ Object
Returns the value of attribute mate.
-
#mv ⇒ Object
Returns the value of attribute mv.
Class Method Summary collapse
Instance Method Summary collapse
- #check? ⇒ Boolean
- #checkmate? ⇒ Boolean
-
#initialize(mv, check, mate) ⇒ Move
constructor
A new instance of Move.
- #to_s ⇒ Object
Constructor Details
#initialize(mv, check, mate) ⇒ Move
Returns a new instance of Move.
74 75 76 |
# File 'lib/rgnuchess.rb', line 74 def initialize(mv,check,mate) @mv,@check,@mate = mv,check,mate end |
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
86 87 88 |
# File 'lib/rgnuchess.rb', line 86 def check @check end |
#mate ⇒ Object
Returns the value of attribute mate.
86 87 88 |
# File 'lib/rgnuchess.rb', line 86 def mate @mate end |
#mv ⇒ Object
Returns the value of attribute mv.
86 87 88 |
# File 'lib/rgnuchess.rb', line 86 def mv @mv end |
Class Method Details
Instance Method Details
#check? ⇒ Boolean
83 84 85 |
# File 'lib/rgnuchess.rb', line 83 def check? @check end |
#checkmate? ⇒ Boolean
80 81 82 |
# File 'lib/rgnuchess.rb', line 80 def checkmate? @mate end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/rgnuchess.rb', line 77 def to_s @mv end |