ASCII hello world

Posted on October 3, 2017

The ASCII generator can finally render some basic shapes. The primitives don’t get rotated yet (all lines are vertical).
It’s possible to combine any number of primitive shapes (currently only Box and Line) and render them into one ASCII image. It’s still very basic but it’s finally possible to actually take a look at the result.
The following input:

putStrLn "WOW"
putStr . render2 dict grids . msum $
    [ draw $ Box (0, 0) (50, 20)
    , draw $ Box (5, 5) (10, 10)
    , draw $ Line (0, 4) (70, 25)
    ]

Produces:

WOW

'|||||||||||||||||||||||||||||||||||||||||||||||| '                   
|                                                 |                   
|                                                 |                   
|                                                 |                   
||||                                              |                   
|   |'||| '                                       |                   
|    | ||||                                       |                   
|    |    ||||                                    |                   
|    |    |   |||                                 |                   
|         |      |||                              |                   
|    '||| '         ||||                          |                   
|                       |||                       |                   
|                          |||                    |                   
|                             ||||                |                   
|                                 |||             |                   
|                                    |||          |                   
|                                       ||||      |                   
|                                           |||   |                   
|                                              ||||                   
                                                  ||||                
'|||||||||||||||||||||||||||||||||||||||||||||||| '   |||             
                                                         |||          
                                                            ||||      
                                                                |||   
                                                                   |||

The algorithm is currently using a dictionary of ASCII characters. I also started testing it with Unicode characters.
It’s working in principle but causes some issues when copying the output into other programs.
I think I’ll end up with two modes for the program (ASCII / Unicode).