Class: RubyKnight::Board::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyknight.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(piece, orig, dest, capture, promotion = false, can_castle = 0) ⇒ Event

Returns 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

#can_castleObject (readonly)

Returns the value of attribute can_castle



341
342
343
# File 'lib/rubyknight.rb', line 341

def can_castle
  @can_castle
end

#captureObject (readonly)

Returns the value of attribute capture



341
342
343
# File 'lib/rubyknight.rb', line 341

def capture
  @capture
end

#destObject (readonly)

Returns the value of attribute dest



341
342
343
# File 'lib/rubyknight.rb', line 341

def dest
  @dest
end

#origObject (readonly)

Returns the value of attribute orig



341
342
343
# File 'lib/rubyknight.rb', line 341

def orig
  @orig
end

#pieceObject (readonly)

Returns the value of attribute piece



341
342
343
# File 'lib/rubyknight.rb', line 341

def piece
  @piece
end

#promotionObject (readonly)

Returns the value of attribute promotion



341
342
343
# File 'lib/rubyknight.rb', line 341

def promotion
  @promotion
end

Instance Method Details

#to_sObject



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