Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

A challenge ...

by BUU (Prior)
on Apr 13, 2002 at 03:10 UTC ( #158734=perlmeditation: print w/ replies, xml ) Need Help??

How many different ways can you find to write
hi 1 hi 2 hi 3 .... hi 9 hi 10
Ill start off with the obvious map {print "hi $_\n";} (1..10);


not really.. your justs tries to print a string. But whatever, stupid node anyways. What about a golf on printing the above in 'ascii art' (i.e. each character must be made up of atleast 3 otherchars)

Comment on A challenge ...
Select or Download Code
(MeowChow) Re: A challenge ...
by MeowChow (Vicar) on Apr 13, 2002 at 03:16 UTC
    Erm, we already have something like this. Its initials are J, A, P, and H.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
      Erm, we already have something like this. Its initials are J, A, P, and H.

      I'm not exactly a golfer (I could never bring myself to wear those funny pants) and I don't see much point in obfuscating code (my time would be better spent learning Lisp) but what's wrong with this node?

      I found it through worst nodes and after my upvote it has a -8 rep. Could somebody clue me into how this is any worse than those 80+ rep golf nodes? Is it just because he didn't include everybody's favorite acronym in it?

Re: A challenge ...
by atcroft (Monsignor) on Apr 13, 2002 at 11:44 UTC
    You may also want to look at the (somewhat similar) thread TMTOWTDI Puzzle: Generating a range of numbers, in which the goal was to write the sequence 1..10 without using the digits 0-9, modules, or mathematical functions (IIRC). I look forward to the responses to come, though.
Re: A challenge ...
by tachyon (Chancellor) on Apr 13, 2002 at 20:04 UTC
    print map qq,\150\151\040$_$/,,s.. ...ord

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: A challenge ...
by Juerd (Abbot) on Apr 13, 2002 at 20:17 UTC

    What about a golf on printing the above in 'ascii art' (i.e. each character must be made up of atleast 3 otherchars)

    That makes no sense at all. Golf is a game where you want only a few strokes, but ascii art requires a lot of characters. Perhaps you meant s/golf/obfuscation/?

    perl -le'print"hi ".++$_ until/0/'
    perl -le'print"hi $_"for+1..10'

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      "That makes no sense at all. Golf is a game where you want only a few strokes, but ascii art requires a lot of characters. Perhaps you meant s/golf/obfuscation/?" Which is why it would be a challenge..
Re: A challenge ...
by Dog and Pony (Priest) on Apr 13, 2002 at 20:31 UTC
    Just another way...
    perl -e 'for($i++;$i<11;print"Hi $i\n"and$i++){}'
    Or the slightly shorter:
    perl -e 'for(;$i<10;$i++,print"Hi $i\n"){}'
    I sometimes wonder if there shouldn't be a separate section in the monastery for challenges... :) Maybe we are getting too few of them for that, but on the other hand maybe that would draw more?
    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://158734]
Approved by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-07-05 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls