Sha256: 59766532b0a9c3e8915bd2fd4ba4a55a9062202265c04f4611f1af255c247713

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module TTT
  class Board
    attr_accessor :squares

    def initialize(args = {})
      @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?
      squares.full?
    end

    def won?
      squares.any_combination_won?
    end

    def display_values
      squares.display_values
    end

    def available_choices
      squares.available_choices
    end

    def number_of_rows_cols
      squares.number_of_rows_cols
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
games_bfox-0.6.0 lib/games/tictactoe/board.rb