class Grid

Attributes

grid_points[R]

Public Class Methods

new() click to toggle source
# File lib/grid.rb, line 5
def initialize
  @grid_points = ["  01","  02","  03","  04","  05",
                  "  06","  07","  08","  09","  10",
                  "  11","  12","  13","  14","  15",
                  "  16","  17","  18","  19","  20",
                  "  21","  22","  23","  24","  25"]
end

Public Instance Methods

input_has_been_entered_previously?(grid_point) click to toggle source
# File lib/grid.rb, line 13
def input_has_been_entered_previously?(grid_point)
  @grid_points[grid_point] == "⚓" || @grid_points[grid_point] == "☠" 
end
record_hit(grid_point) click to toggle source
# File lib/grid.rb, line 17
def record_hit(grid_point)
  @grid_points[grid_point] = "⚓"
end
record_miss(grid_point) click to toggle source
# File lib/grid.rb, line 21
def record_miss(grid_point)
  @grid_points[grid_point] = "☠"
end