Class: RubyKnight::Board::Event
- Inherits:
-
Object
- Object
- RubyKnight::Board::Event
- Defined in:
- lib/rubyknight.rb
Instance Attribute Summary (collapse)
-
- (Object) can_castle
readonly
Returns the value of attribute can_castle.
-
- (Object) capture
readonly
Returns the value of attribute capture.
-
- (Object) dest
readonly
Returns the value of attribute dest.
-
- (Object) orig
readonly
Returns the value of attribute orig.
-
- (Object) piece
readonly
Returns the value of attribute piece.
-
- (Object) promotion
readonly
Returns the value of attribute promotion.
Instance Method Summary (collapse)
-
- (Event) initialize(piece, orig, dest, capture, promotion = false, can_castle = 0)
constructor
A new instance of Event.
- - (Object) to_s
Constructor Details
- (Event) initialize(piece, orig, dest, capture, promotion = false, can_castle = 0)
A new instance of Event
342 343 344 345 346 347 348 349 350 |
# File 'lib/rubyknight.rb', line 342 def initialize piece, orig, dest, capture, promotion=false, can_castle=0 @piece = piece @orig = orig @dest = dest @capture = capture @promotion = promotion @can_castle = can_castle end |
Instance Attribute Details
- (Object) can_castle (readonly)
Returns the value of attribute can_castle
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def can_castle @can_castle end |
- (Object) capture (readonly)
Returns the value of attribute capture
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def capture @capture end |
- (Object) dest (readonly)
Returns the value of attribute dest
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def dest @dest end |
- (Object) orig (readonly)
Returns the value of attribute orig
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def orig @orig end |
- (Object) piece (readonly)
Returns the value of attribute piece
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def piece @piece end |
- (Object) promotion (readonly)
Returns the value of attribute promotion
341 342 343 |
# File 'lib/rubyknight.rb', line 341 def promotion @promotion end |
Instance Method Details
- (Object) to_s
352 353 354 355 356 357 |
# File 'lib/rubyknight.rb', line 352 def to_s Board.position_to_coord(@orig) +\ Board.position_to_coord(@dest) +\ (@promotion ? Board.SYMBOLS[@promotion] : "") end |