Sha256: 73738abc86c8a2ac1f5ff38a942630ea032f5cafd94cae4ead1b2037574bfc9b

Contents?: true

Size: 707 Bytes

Versions: 3

Compression:

Stored size: 707 Bytes

Contents

module WordSearch
  module ThreeDimensional
    class PositionWord < PositionWord::Base
      private

      def place_letter(letter)
        plane[coordinate.x][coordinate.y][coordinate.z].letter = letter
      end

      def update_coordinates
        coordinate.x += direction.x
        coordinate.y += direction.y
        coordinate.z += direction.z
      end

      def positive_last_coordinates?
        last_x >= 0 && last_y >= 0 && last_z >= 0
      end

      def last_coordinates_in_plane?
        last_x < plane.x && last_y < plane.y && last_z < plane.z
      end

      def letter_at(position)
        plane.dig(x_at(position), y_at(position), z_at(position)).letter
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
word_search-0.5.1 lib/word_search/three_dimensional/position_word.rb
word_search-0.5.0 lib/word_search/three_dimensional/position_word.rb
word_search-0.1.0 lib/word_search/three_dimensional/position_word.rb