Method: VeryGood::State#set

Defined in:
lib/very_good/state.rb

#set(x, y, cell) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/very_good/state.rb', line 12

def set(x, y, cell)
  new_state = @state.map do |line|
    line.dup
  end

  new_state[y][x] = cell

  State.new(
    width: width,
    height: height,
    state: new_state,
    cursor: cursor
  )
end