class Theseus::Formatters::ASCII::Upsilon
Renders an UpsilonMaze
to an ASCII
representation, using 3 characters horizontally and 4 characters vertically to represent a single octagonal cell, and 3 characters horizontally and 2 vertically to represent a square cell.
_ _ _ / \_/ \_/ \ | |_| |_| | \_/ \_/ \_/ |_| |_| |_| / \_/ \_/ \
You shouldn't ever need to instantiate this class directly. Rather, use UpsilonMaze#to
(:ascii) (or UpsilonMaze#to_s
to get the string directly).
Public Class Methods
new(maze, options={})
click to toggle source
Returns a new Sigma
canvas for the given maze (which should be an instance of SigmaMaze
). The options
parameter is not used.
The returned object will be fully initialized, containing an ASCII
representation of the given SigmaMaze
.
Calls superclass method
Theseus::Formatters::ASCII::new
# File lib/theseus/formatters/ascii/upsilon.rb, line 25 def initialize(maze, options={}) super(maze.width * 2 + 1, maze.height * 2 + 3) maze.height.times do |y| py = y * 2 maze.row_length(y).times do |x| cell = maze[x, y] next if cell == 0 px = x * 2 if (x + y) % 2 == 0 draw_octogon_cell(px, py, cell) else draw_square_cell(px, py, cell) end end end end