Class: Pacman::BoardComponent
- Inherits:
-
Charming::Component
- Object
- Charming::Component
- Pacman::BoardComponent
- Defined in:
- app/components/board_component.rb
Overview
Draws the maze as a grid of blocks. Each maze cell becomes scale terminal
rows by scale * 2 columns, so the board can grow to fill large terminals.
Constant Summary collapse
- WALL_STYLE =
Charming::UI.style.foreground("#2121de")
- PELLET_STYLE =
Charming::UI.style.foreground("#ffb8ae")
- CHERRY_STYLE =
Charming::UI.style.foreground("#ff2121").bold
- STEM_STYLE =
Charming::UI.style.foreground("#21c821")
- PLAYER_STYLE =
Charming::UI.style.foreground("#ffff00").bold
- FRIGHTENED_STYLE =
Charming::UI.style.foreground("#2121de").bold
- EATEN_STYLE =
Charming::UI.style.foreground("#ffffff")
- GHOST_STYLES =
[ Charming::UI.style.foreground("#ff0000").bold, Charming::UI.style.foreground("#ffb8de").bold, Charming::UI.style.foreground("#00ffde").bold, Charming::UI.style.foreground("#ffb847").bold ].freeze
Instance Method Summary collapse
Instance Method Details
#render ⇒ Object
21 22 23 |
# File 'app/components/board_component.rb', line 21 def render (0...maze.height).flat_map { |row| block_rows(row) }.join("\n") end |