Coding Challenges - Dlang or Generic

matheus matheus at gmail.com
Tue Jan 10 10:57:38 UTC 2023


On Tuesday, 10 January 2023 at 05:21:15 UTC, H. S. Teoh wrote:
>
> Printing it in this format is trivial, and not very 
> interesting.  The interest in the challenge is to lay it out 
> like I posted, side-by-side,...

Like I said I did it over D online compiler which unfortunately I 
couldn't validate the output because it "wraps" the text, and the 
font wasn't monospace.

But It just a case of changing the loop in a way to print 3 
groups of months.

> ... and to do so in a way that the code is clean, maintainable, 
> and consists of reusable components. ...

Talking about modularity and reusable components, I really think 
it depends, because if that's was really the case, then I would 
think of using the OS functions to move the cursor around (If 
console/terminal) to print a given month in some location or side 
by side until reach some horizontal limit (Terminal), then it 
could be 1 column only (Like I did), 2, 3 and maybe 4 columns if 
the terminal/resolution permit, and for that I would use ARSD. :]

But I think this would be too much for this kind of thing writing 
on online compiler.

> ... That's where the challenge lies.

To be honest when I saw your proposal, I really thought that the 
real challenge would be to write my own algo to handle the date, 
and I was pretty sure after posting above, you would say that, 
but not about the layout or printing in groups. =]

Matheus.


More information about the Digitalmars-d-learn mailing list