Files
ioccc/2014/maffiodo2
Landon Curt Noll e00d20111d rename .inventory.html -> inventory.html
Due to GitHub not serving nor rendering HTML files whose filename
starts with "." (dot), we renamed `.inventory.html` to `inventory.html`.

Renamed: `tmp/gen_dot_winner.sh` -> `tmp/gen_winner_json.sh`
Fixed URL generation for GitHub links in `inventory.html`.

The manifest was updated accordingly.

The `tmp/README.md` file was updated accordingly.
2023-11-06 02:23:30 -08:00
..
2020-12-30 16:57:03 -08:00
2023-11-01 00:47:43 -07:00
2023-11-01 03:36:29 -07:00
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00

To build:

make

To use:

./prog arg

Try:

cat image.rgb | ./prog '  .,:;!$#@'

Judges' remarks:

On the face of it :-) given what this program does one might wonder what makes this winner special. But when you realize the source is small enough for posting to social media that has a small size limit.

Who will be the first to tweet this source? How many re-tweets will such tweet get? And how many people will really understand the tweet?

Author's remarks:

Remarks

This program convert an image to an ASCII ART. The program reads a raw RGB image from stdin and print the ASCII ART to stdout.

The build process will raise some warnings about:

  • declaration specifier missing, defaulting to 'int'
  • implicitly declaring library function

The program crash if run without parameters.

Screen size

If you have a terminal geometry than is different from the common 80x25 you can modify the output width by changing the value of the first variable:

d=80,

Something to try

Type this:

cat image.rgb | ./prog "  .:;Y0"

You can use your own image. Convert the image to a raw RGB image, using imagemagick it's very simple:

convert -geometry 80x source.jpg image.rgb

This program require one parameter, or crash. The parameter of the program is the convertion ramp. You can use different ramps or create your own (for ex. using some letters of your name). These are some ramps you can try:

./prog " :1"
./prog "  .:;Y0"
./prog " .:-=+*#%@"
./prog "   .,:!-iots&8%#@$"
./prog "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,"^`'. "

121 byte version

An alternative version of this program is only 121bytes long:

d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}

This alternative version have a fixed ramp. It's smaller but it's not so fun to use...

This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved. You are free to share and adapt this file under the terms of this license:

Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

For more information, see: https://creativecommons.org/licenses/by-sa/4.0/