Sha256: 89dc0d6ad1efe00f360a39fadcdb0c8e0ddacbb954c22db2f89d8c9ae0e2ecd4

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

module Model
  class Move
    attr_reader :tile, :piece

    def initialize(tile, piece)
      @tile = tile
      @piece = piece
    end

    class << self
      def generate_moves(piece, board)
        board.available_tiles.map { |tile| generate_move(tile, piece) }
      end

      def generate_move(tile, piece)
        new(tile, piece)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sams_tic_tac_toe-0.0.1 lib/tic_tac_toe/model/move.rb