Sha256: a000f2388fc314e8f30af5f6f695dc675c3a30bed09f49908d104cec8e3bf07f

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

module TTT
  class Board
    attr_accessor :rows_and_cols, :squares

    def initialize(args = {})
      @rows_and_cols = args[:rows_and_cols]
      @squares = args[:squares]
    end

    def change_square(display_value, new_value)
      square_to_change = retrieve_square(display_value)
      square_to_change.change_value(new_value)
    end

    def full?
      return squares.full?
    end

    def won?
      return squares.any_combination_won?
    end

    def display_values
      return squares.display_values
    end

    def available_choices
      return squares.available_choices
    end

    def number_of_rows
      rows_and_cols
    end

    private
    def retrieve_square(display_value)
      return squares.retrieve_square(display_value)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
games_bfox-0.3.0 lib/games/tictactoe/board.rb
games_bfox-0.2.0 lib/games/tictactoe/board.rb