Quickies

[categories] [index] [all (552)] [latest]

PostScript
  1. "BEST OBFUSCATED ARTWORK" at 1993 Obfuscated PostScript Contest

    Deciphered from https://stuff.mit.edu/afs/sipb/contrib/postscript/obfuscated-1993/

    % "load def" pairs of names
    /a/add
    /s/sub
    /m/mul
    /d/div
    count 2 idiv { load def } repeat
    
    /decode {
        {
            ( ) dup 0 4 -1 roll put         % char to string
    
            dup (0) ge 1 index (9) le and { % is digit?
                cvi                         % char to int
            } {                             % is operator
                cvn                         % char to name
    
                dup where {                 % name known?
                    exch get exec           % exec mapped operator
                } {
                    pop                     % name unknown, ignore
                } ifelse
            } ifelse
        } forall
    } def
    
    (Test 1 2 a -> 3) =
    (1 2 a) decode =
    
    (Testing 3 4 m -> 12) =
    (3 4 m) decode =
    
    (Test 12a3m -> 9) =
    (12a3m) decode =
    
    (Test 23a4m -> 20) =
    (23a4m) decode =