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://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtbP3Rm0BJ9WhlfyQH-MsN7mmnRSqf4Wynd3mdnMEDCxFooKz84VtcX7zEyV3KMQH5dlBJSnubZGYxs7WXOn4ZOTj2SFv7X5GZ1EdooOR7_MZ5TiG8XQ0z8ZDt7dAOmz_6vM91CNsIUsM/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://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjvfQvpENVhF-rmskI3LafbODCKJw3XI8oHjPnsN_7bBxmG0DK2bGJ_NpX9_p-nehl-qXmMgDq6K_E4PtXj5VmNxNgIXfI2kcP1oetEpzuOLMdw1C7XMq-5A_Vrkf4VveTMdUx4sCRkHw/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://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW2YSzdmWhG9ZCWYEgjlHCH5g7mwmTBXhPL5rsY2h3h8rcM0gvIcIZBP4Wke44MnQexd1CIT1sBBPoJ7JfB0w6RgkWMbyKwXAbmdOFOyJzk7ADUpU5e1zGvz9cK4sz7_gKQjcLa06AakM/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 it’s a verb. As for what it actually mean, I have no clues.

It comes with nice help message and even configuration file for you to set up a pony and information you want to display, so you don’t need to use command-line option every time you take a screenshot.

The list of ponies includes, from README, so far, 16 ponies or 21 with variations:

  • Twilight Sparkle (Both as a unicorn and as an alicorn)
  • Rainbow Dash (Both with open and with closed wings)
  • Fluttershy
  • Rarity
  • Pinkie Pie
  • Applejack (Both with and without the hat)
  • Derpy
  • Trixie (Both with and without the hat)
  • Rose
  • Lyra Heartstrings
  • DJ Pon3 (Both with and without shades)
  • Princess Celestia
  • Princess Luna
  • Big McIntosh
  • Princess Cadance
  • Colgate

I have too many ponies for a day.

ASCII-Pony was created by Mattia Basaglia on 2013-11-06, written in Bash with lsb-release, lxc for container info, and PHP for pony generation under the GPLv3+ and CC-BY-SA 3.0, currently git-a592ea8 (2016-01-02).

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:


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

Let’s 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 can’t say it’s fully ported in terms of options, but I would say they are close, the CLI isn’t 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 isn’t a good idea.

With pyfiglet, you don’t 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 FIGlet’s fonts, I don’t know if it’s considered as a port or not.