lib/reversi/board.rb
def to_s
      "     #{[*'a'..'h'].join("   ")}\n" <<
      "   #{"+---"*8}+\n" <<
      (0..63).map do |i|
        case 1
        when get_black[63 - i] then "\e[#{@options[:disk_color_b]}m#{@options[:disk_b]}\e[0m"
        when get_white[63 - i] then "\e[#{@options[:disk_color_w]}m#{@options[:disk_w]}\e[0m"
        else " "
        end
      end
      .map{ |e| "| #{e} |" }.each_slice(8).map(&:join)
      .map{ |line| line.gsub(/\|\|/, "|") }
      .tap{ |lines| break (0..7).map{ |i| " #{i+1} #{lines[i]}" } }
      .join("\n   #{"+---"*8}+\n") <<
      "\n   #{"+---"*8}+\n"
    end
# Returns a string of the game board in human-readable form.
#
# @return [String]
Returns a string of the game board in human-readable form.
Returns a string of the game board in human - readable form .
def to_s
      "     #{[*'a'..'h'].join("   ")}\n" <<
      "   #{"+---"*8}+\n" <<
      (0..63).map do |i|
        case 1
        when get_black[63 - i] then "\e[#{@options[:disk_color_b]}m#{@options[:disk_b]}\e[0m"
        when get_white[63 - i] then "\e[#{@options[:disk_color_w]}m#{@options[:disk_w]}\e[0m"
        else " "
        end
      end
      .map{ |e| "| #{e} |" }.each_slice(8).map(&:join)
      .map{ |line| line.gsub(/\|\|/, "|") }
      .tap{ |lines| break (0..7).map{ |i| " #{i+1} #{lines[i]}" } }
      .join("\n   #{"+---"*8}+\n") <<
      "\n   #{"+---"*8}+\n"
    end
def to_s "     #{[*'a'..'h'].join("   ")}\n" << "   #{"+---"*8}+\n" << ( 0 .. 63 ) . map do | i | case 1 when get_black [ 63 - i ] then "\e[#{@options[:disk_color_b]}m#{@options[:disk_b]}\e[0m" when get_white [ 63 - i ] then "\e[#{@options[:disk_color_w]}m#{@options[:disk_w]}\e[0m" else " " end end . map { | e | "| #{e} |" } . each_slice ( 8 ) . map ( & :join ) . map { | line | line . gsub ( / \| \| / , "|" ) } . tap { | lines | break ( 0 .. 7 ) . map { | i | " #{i+1} #{lines[i]}" } } . join ( "\n   #{"+---"*8}+\n" ) << "\n   #{"+---"*8}+\n" end
Returns a string of the game board in human-readable form.
Returns a string of the game board in human - readable form .
None
String