Class Piece
In: lib/bangkok/piece.rb
Parent: Object

Methods

Attributes

color  [R] 
piece  [R] 
square  [R] 

Public Class methods

Factory method that creates a piece of the proper subclass

Public Instance methods

Checks diagonals and straight horizontal/vertical lines. Won‘t work correctly for anything else.

Make sure this piece can perform move. This implementation checks the basics (the color and type of this piece and the emptiness or color of the piece at the destination square); subclasses add further checks.

[Validate]