addstr is more generic
This commit is contained in:
parent
11cda31ce7
commit
d9f070c92e
1 changed files with 5 additions and 5 deletions
|
@ -26,13 +26,13 @@ def display_curses( field, state = { dead: false, victory: false } )
|
||||||
Curses.setpos y + 2, 0
|
Curses.setpos y + 2, 0
|
||||||
field.width.times do |x|
|
field.width.times do |x|
|
||||||
if [field.explorer_x, field.explorer_y] == [x, y]
|
if [field.explorer_x, field.explorer_y] == [x, y]
|
||||||
Curses.addch 'o'
|
Curses.addstr 'O'
|
||||||
elsif [field.width, field.height] == [x + 1, y + 1]
|
elsif [field.width, field.height] == [x + 1, y + 1]
|
||||||
Curses.addch '_'
|
Curses.addstr '^'
|
||||||
elsif field.field[[x, y]].open
|
elsif field.field[[x, y]].open || state[:dead] || state[:victory]
|
||||||
Curses.addch field.field[[x, y]].mine ? '*' : ' '
|
Curses.addstr field.field[[x, y]].mine ? '*' : ' '
|
||||||
else
|
else
|
||||||
Curses.addch 'H'
|
Curses.addstr '-'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue