Sha256: 00b67548a23aa52641fb40dad3c22b28eb2e3af481bac83b66a7bd69e7564ff4

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

module TTT
  class BoardPresenterTerminal
    def present_board(board)
      #board.display_values will return multidimensional array
      display_values = board.display_values
      display_values.each do |row|
        row.each_with_index do |display_value, index|
          #http://www.evc-cit.info/cit020/beginning-programming/chp_04/file_printf.html
          printf "%2s", display_value
          print " | " unless index == (row.size - 1)
        end
        print "\n"
        puts "_"*(row.size * 5) unless row.equal? display_values.last
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tic_tac_toe_bfox-0.3.0 lib/tictactoe/board_presenter_terminal.rb
tic_tac_toe_bfox-0.2.0 lib/tictactoe/board_presenter_terminal.rb
tic_tac_toe_bfox-0.1.0 lib/tictactoe/board_presenter_terminal.rb