[Neworleans-pm] Fwd: Perl 'Expert' Quiz-of-the-Week #19

Brett D. Estrade estrabd at yahoo.com
Thu Jul 15 19:23:32 CDT 2004




=====
http://www.brettsbsd.net/~estrabd

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

----- Original message -----
From: "Jerrad Pierce" <belg4mit at MIT.EDU>
To: perl-qotw at plover.com
Date: Thu, 15 Jul 2004 19:54:46 -0400
Subject: Perl 'Expert' Quiz-of-the-Week #19


IMPORTANT: Please do not post solutions, hints, or other spoilers
        until at least 60 hours after the date of this message.
        Thanks.

IMPORTANTE: Por favor, no enviéis soluciones, pistas, o cualquier otra
        cosa que pueda echar a perder la resolución del problema hasta
        que hayan pasado por lo menos 60 horas desde el envío de este
        mensaje. Gracias.

IMPORTANT: S'il vous plaît, attendez au minimum 60 heures après la
        date de ce message avant de poster solutions, indices ou autres
        révélations. Merci.

WICHTIG: Bitte schicken Sie keine Lösungen, Tipps oder Hinweise für
        diese Aufgabe vor Ablauf von 60 Stunden nach dem Datum dieser
        Mail. Danke.

BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de
        eerste 60 uur na het verzendingstijdstip van dit
        bericht. Waarvoor dank.

VNIMANIE: Pozhalujsta ne shlite reshenija, nameki na reshenija, i
        voobshe lyubye podskazki v techenie po krajnej mere 60 chasov
        ot daty etogo soobshenija.  Spasibo.

Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60
        Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4
        Xie4Lou4 Da2An4 De5 Jian4Yi4.  Xie4Xie4.


----------------------------------------------------------------

banner(1) and cursive(1) are old UNIX utilities that take ASCII input
(0-127)
and render the input in a hard-coded font like the examples below.
Later,
FIGlet was created to use a plain text format font file to allow a wider
variety of output styles.

  % banner japh

         #    #    ######  #     #
         #   # #   #     # #     #
         #  #   #  #     # #     #
         # #     # ######  #######
   #     # ####### #       #     #
   #     # #     # #       #     #
    #####  #     # #       #     #

   % cursive japh

                   /
       o __.  _   /_
      /_(_/|_/_)_/ /_
     /      /
   -'      '

Write a program to do "optical" character recognition of ASCII-Art text.
Given an input string provided on STDIN print the text represented by
the ASCII-art to STDOUT.

There are three milestones for this puzzle.

1) Process any output produced by banner(1) and print the result to
   STDOUT.  Your program should obviously print "JAPH" or "japh" at
   your discretion, if given the output from banner above; but not
   "jAph".

   If you do not have banner(1) or your banner prints vertically instead
   of
   horizontally use the banner font for FIGlet.

   Both the font and FIGlet itself are available at
     http://figlet.org/
   OR
     ftp://pthbb.org/mirror-mirror/figlet/

   Instead, you could also use one of the many web interfaces for
   generating
   FIGlet output such as http://wfiglet.handalak.com/


For the next two milestones you need to download some FIGlet fonts
available at
  ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz
OR
  ftp://pthbb.org/mirror-mirror/figlet/fonts/contributed.tar.gz

The FIGlet font file format is rather intuitive but described at length
in
the FIGlet man page widely available online including
  http://www.redstone.army.mil/documents/figlet-2.1.1.man.html

A tarball with a special issue of the Text::FIGlet module is available
at
     ftp://pthbb.org/pub/misc/qotw.tgz
It includes perl versions bof figlet and banner, and the figlet man page

2) Process any output produced by FIGlet with the basic and drpepper
fonts.
   Your output should be as before.

   In addition to the text to process from STDIN you must accept an
   argument
   -f=<font> specifying the path to the font the input was created with.

   % figlet -f basic -A basic
      d88b  .d8b.  d8888b. db   db
      `8P' d8' `8b 88  `8D 88   88
       88  88ooo88 88oodD' 88ooo88
       88  88~~~88 88~~~   88~~~88
   db. 88  88   88 88      88   88
   Y8888P  YP   YP 88      YP   YP


   % !! | yourprogram.pl -f=figlib/basic.flf
   JAPH
   % figlet -f drpepper -A japh
     _            _
    <_> ___  ___ | |_
    | |<_> || . \| . |
    | |<___||  _/|_|_|
   <__'     |_|
   % !! | yourprogram.pl -f=figlib/drpepper.flf
   japh

3) Process any output produced by FIGlet with the argument -m-1 and a
font
   from the library listed above. You should accept an argument -d=<dir>
   which
   specifies the location of the font library. Programatically determine
   the
   font used to render the provided input and process accordingly. Your
   output
   should be as before with the name of the font chosen printed to
   STDERR
   before the results are printed to STDOUT.

                                       /
           #                         #/
          ###                        ##
           #                         ##
                                     ##
         ###      /###       /###    ##  /##
          ###    / ###  /   / ###  / ## / ###
           ##   /   ###/   /   ###/  ##/   ###
           /   ##    ##   ##    ##   ##     ##
          /    ##    ##   ##    ##   ##     ##
         ###   ##    ##   ##    ##   ##     ##
          ###  ##    ##   ##    ##   ##     ##
           ### ##    /#   ##    ##   ##     ##
            ### ####/ ##  #######    ##     ##
             ##  ###   ## ######      ##    ##
             ##           ##                /
             /            ##               /
            /             ##              /
           /               ##            /


PS> For the interminably curious to see why the condition of -m-1 is
imposed
    compare the output of the font slscript with and wihtout it.





More information about the NewOrleans-pm mailing list