Sha256: 9d4dc063cdbdd79a3615636e12d388c2690df555e8fb9a9ec60301a66ebdc874

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

module MM
  class Board
    attr_accessor :number_of_rows, :number_of_cols, :pegs, :result_pegs

    def initialize(args = {})
      @number_of_rows = args[:number_of_rows]
      @number_of_cols = args[:number_of_cols]
      @pegs = args[:pegs]
      @result_pegs = args[:result_pegs]
    end

    def change_peg(row, col, new_value)
      peg_to_change = retrieve_peg(row, col)
      peg_to_change.change_value(new_value)
    end

    def display_values
      pegs.display_values
    end

    def result_values
      result_pegs.display_values
    end

    def pegs_current_row(number_of_turns_taken)
      pegs.current_row(number_of_turns_taken)
    end

    def result_pegs_current_row(number_of_turns_taken)
      result_pegs.current_row(number_of_turns_taken)
    end

    private
      def retrieve_peg(row, col)
        pegs.retrieve_peg(row, col)
      end

      #result_pegs is an instance of pegs
      def retrieve_result_peg(row, col)
        result_pegs.retrieve_peg(row,col)
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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