[C-prog-lang-l] mountain art competition

Vladimír Kotal vlada at devnull.cz
Sat Mar 16 00:09:01 CET 2019


Wow, such sophisticated ASCII art produced by such a small program !

Some nits:
  - the style needs some improvements, e.g.:
    - inconsistence with indentation in if/else blocks
    - lack of empty lines (e.g. between L65/66 - these 2 pieces do
different things)
    - insufficient indent e.g. L24, L26, L33
    - consider using curly brackets for multiline blocks under if/else/for
(L60-L65)
    - space vs. non space after array name in declaration (L10 vs. L11)
    - white space between includes and defines

Again, no matter what style you use, just try to be consistent.

Regards,


V. Kotal

On Fri, Mar 15, 2019 at 11:58 PM Filip S <hyppercrone at gmail.com> wrote:

> Hello,
>
> I used 3 functions. One for initialization, one for filling the array and
> lastly for printing the mountain.
> I also added some snowflakes and some random details on the mountains
> themselves. I made it so there is an option to keep them.
> Printing multiple mountains over each other makes it also a little more
> detailed.
> [image: Mountain.JPG]
>
> The code is in the attachment. I'm sorry about the for-loops. :)
>
> Regards,
> Filip Sedlák
>
> pá 15. 3. 2019 v 4:56 odesílatel Vladimír Kotal <vlada at devnull.cz> napsal:
>
>> In addition to the creative enhancement (reminds me of
>> https://ajmysmetatry.sk/), the code is nicely structured with a good
>> style.
>>
>> Some minor nits:
>>   - separate the defines and includes with blank line
>>   - be consistent: rand() % 3 vs. rand()%3
>>   - multiword identifiers can be made more readable somehow (either use
>> https://en.wikipedia.org/wiki/Camel_case or underscores)
>>   - you are cheating a little bit with those for loops :-) as we have not
>> introduced them yet
>>   - snow caps drawing can be refactored into its own function - it's
>> extra feature, maybe later on can be governed by an option
>>
>> Regards,
>>
>> V. Kotal
>>
>> On Thu, Mar 14, 2019 at 12:32 PM Peter G <peter.grajcar131 at gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> I have used two functions. One for the printing the mountain and second
>>> for filling the columns of the array. I also added mountain snow caps,
>>> which are generated above certain height level.
>>>
>>> I put the code on GitHub. It can be found there:
>>> https://github.com/peter-grajcar/the-c-programming-language/blob/master/src/mountains.c
>>>
>>> As an example I attached picture of my mountains.
>>>
>>> Regards,
>>> Peter Grajcar
>>>
>>> .
>>> _______________________________________________
>>> c-prog-lang-l mailing list
>>> c-prog-lang-l at mff.cuni.cz
>>> http://mbox.ms.mff.cuni.cz/listserv/listinfo/c-prog-lang-l
>>>
>> _______________________________________________
>> c-prog-lang-l mailing list
>> c-prog-lang-l at mff.cuni.cz
>> http://mbox.ms.mff.cuni.cz/listserv/listinfo/c-prog-lang-l
>>
> _______________________________________________
> c-prog-lang-l mailing list
> c-prog-lang-l at mff.cuni.cz
> http://mbox.ms.mff.cuni.cz/listserv/listinfo/c-prog-lang-l
>
-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2019-03-14 at 11.46.13.png
Type: image/png
Size: 31344 bytes
Desc: not available
URL: <http://mbox.ms.mff.cuni.cz/listserv/archive/c-prog-lang-l/attachments/20190316/0f671b40/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mountain.JPG
Type: image/jpeg
Size: 86527 bytes
Desc: not available
URL: <http://mbox.ms.mff.cuni.cz/listserv/archive/c-prog-lang-l/attachments/20190316/0f671b40/attachment.jpe>


More information about the c-prog-lang-l mailing list