aboutsummaryrefslogtreecommitdiffstats
path: root/board.rb
blob: c990218c507df057a48d43d5d88617e33621257a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Board
  def initialize
    @board = [
      ['.', '.', '.'],
      ['.', '.', '.'],
      ['.', '.', '.']
    ]
  end
  
  def render
    "...\n" * 3
  end
  
  # Raises an ArgumentError if integer conversion fails
  def transform_coordinates(str)
    coordinates = str.split(',')
    
    begin
      coordinates[0] = Integer(coordinates[0])
      coordinates[1] = Integer(coordinates[1])
      
      coordinates if coordinates.length > 1
    rescue
    end
  end
end