As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label ASCII art. Show all posts

ASCII Flappy Bird! is yet another bird trying hard to flap through tiny gaps of endless obstacles.

https://lh3.googleusercontent.com/-k1gWpyE5cuk/VqAP470j0pI/AAAAAAAAI_0/OJIe2zirTXk/s800-Ic42/ascii_flappy_bird.gif

It has a nice title screen and sad death screen. You know the drill, just Space to fly away.

ASCII Flappy Bird! was created by Hamik Mukelyan, writen in C with ncurses for terminal size 80x24+, under the MIT License, currently git-1c56b7b (2016-01-19).

konsole_invaders is yet another clone, but it feels more action packed, because you have to keep tapping firing keys.

https://lh3.googleusercontent.com/-linHJ8U-yiQ/VprG3xL-3gI/AAAAAAAAI7g/UAxhakKSWis/s800-Ic42/konsole_invaders.gif

It supports WASD, HJKL, and arrow keys, plus Space for firing. It has scores, lives, and rockets. You get an extra life and rocket capacity once you clear a level or a wave of aliens. Detailed options for customize the gameplay, which can also be set with configuration file. Different types of alien ships, as deeper into levels, you get the stronger enemies.

Although, it looks good in many aspects, not so on other things. Such as big terminal size requirements, probably due to ASCII art of alien ships; and as you advance to later waves, you constantly have to press the firing key, if there was an auto-firing switch it would be much easier to play and for your wrist.

konsole_invaders was created by Fabian Ebner on 2011-08-17, written in C99 with terminal size 103x44+ under the GPLv3+, currently git-42b96db (2016-01-16)

ASCII-Pony is a screenshot information tool, but it does not display distribution logo like screenFetch, ponies from My Little Pony: Friendship Is Magic (2010-) instead, which is an animated television show for children.

https://lh3.googleusercontent.com/-4firlCDbHHk/VohyIxUeyII/AAAAAAAAIyM/l6fTI8UqOXQ/s800-Ic42/ASCII-Pony.gif

The script is even named systempony, how fitting to this pony overloading tool. You pony it for screenshot, pretty sure its a verb. As for what it actually mean, I have no clues.

Everyone knows FIGlet or at least have seen once or twice the output of FIGlet even whether they know what generates those or not. But not everyone knows that there is a port1 of FIGlet, I was one of them until I came across a program called termdown, which is a countdown timer and depends on the port of FIGlet, pyfiglet:

                        _|_|  _|            _|              _|
_|_|_|    _|    _|    _|            _|_|_|  _|    _|_|    _|_|_|_|
_|    _|  _|    _|  _|_|_|_|  _|  _|    _|  _|  _|_|_|_|    _|
_|    _|  _|    _|    _|      _|  _|    _|  _|  _|          _|
_|_|_|      _|_|_|    _|      _|    _|_|_|  _|    _|_|_|      _|_|
_|              _|                      _|
_|          _|_|                    _|_|

Lets compare the CLIs, FIGlet v2.2.2 (2005-08-05) and pyfiglet v0.7 (2014-06-08):

$ figlet -h
figlet: invalid option -- 'h'
Usage: figlet [ -cklnoprstvxDELNRSWX ] [ -d fontdirectory ]
              [ -f fontfile ] [ -m smushmode ] [ -w outputwidth ]
              [ -C controlfile ] [ -I infocode ] [ message ]

$ pyfiglet -h
Usage: pyfiglet [options] [text..]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -f FONT, --font=FONT  font to render with (default: standard)
  -D DIRECTION, --direction=DIRECTION
                        set direction text will be formatted in (default:
                        auto)
  -j SIDE, --justify=SIDE
                        set justification, defaults to print direction
  -w COLS, --width=COLS
                        set terminal width for wrapping/justification
                        (default: 80)
  -r, --reverse         shows mirror image of output text
  -F, --flip            flips rendered output text over
  -l, --list_fonts      show installed fonts list
  -i, --info_font       show font's information, use with -f FONT

Well, I cant say its fully ported in terms of options, but I would say they are close, the CLI isnt the point here, but the programmical interface is, that you can just get a FIGlet-style output right in your Python script. I always shake my head whenever I see someone coding something like the following:

os.system('clear')
os.system('tput cup 0 0')

Why do I dislike code above? Just think about should you do in that way, you would understand why usually think this isnt a good idea.

With pyfiglet, you dont need to pipe in FIGlet if you really want those big text with fancy fonts. You just import the library and generate like, from README:

>>> from pyfiglet import Figlet
>>> f = Figlet(font='slant')
>>> print f.renderText('text to render')
   __            __     __                               __
  / /____  _  __/ /_   / /_____     ________  ____  ____/ /__  _____
 / __/ _ \| |/_/ __/  / __/ __ \   / ___/ _ \/ __ \/ __  / _ \/ ___/
/ /_/  __/>  </ /_   / /_/ /_/ /  / /  /  __/ / / / /_/ /  __/ /
\__/\___/_/|_|\__/   \__/\____/  /_/   \___/_/ /_/\__,_/\___/_/

It supports many fonts, maybe even all of FIGlet fonts, run pyfiglet -l to get the list.

pyfiglet is made by Christopher Jones, Stefano Rivera, and Peter Waller, under the GPLv2. It first appeared in 2007, now the version 0.7 (2014-06-08), works for both Python 2 and 3.

[1]There is a project called TOIlet, although it can loads FIGlets fonts, I dont know if its considered as a port or not.