refactored chessboard.rb