Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I wrote something for you.

Name: Anonymous 2007-04-23 14:57 ID:qqJh/wtq


#include <stdio.h>
int main(int c,char**v) {
        char *s="B+p:ubYBGG0,|M3B=1*0N\n"
                "it's touring complete\n",*k[]={s+21,--s};
        return c?({while(main(!k,k))putchar(**k^*k[1]-10);0;}):(v[1]++,*++*v);
}


Build with GCC.

Name: Anonymous 2009-11-29 5:40

OP's code is valid, but it's nothing more than a simple exercise in source code obfucation. Code should be as readable as possible, unless there's reason not to do that. Here's a rewritten version of his code, that does roughly the same in a more idiomatic manner:

#include <stdio.h>
int main(int argc,char *argv[])
{
        char *s1="B+p:ubYBGG0,|M3B=1*0N",
             *s2="it's touring complete";
        int i, len = strlen(s1);
        for (i = 0; i < len ; i++)
          putchar((s1[i]-10)^s2[i]);
        return 0;
}

Name: >>37 2009-11-29 5:53

Surprisingly, for some things, the C version is easier to read than the Lisp one:

(loop
  for c1 across "B+p:ubYBGG0,|M3B=1*0N"
  for c2 across "it's touring complete"
  do (princ (code-char (logxor (- (char-code c1) 10) (char-code c2)))))

;;; or a more lispy
(defun dec-str (s1 s2)
  (map 'string #'(lambda (c1 c2)
           (code-char (logxor (- (char-code c1) 10)
                      (char-code c2))))
       s1 s2))

(princ (dec-str "B+p:ubYBGG0,|M3B=1*0N" "it's touring complete"))

Name: Anonymous 2009-11-29 15:37

>>40
main =
   do let s1 = "B+p:ubYBGG0,|M3B=1*0N"
      let s2 = "it's touring complete"
      putStrLn $ map chr $ zipWith ((xor.(+(-10)))`on`ord) s1 s2

Name: Anonymous 2009-11-29 15:43

>>42
main =
   do let s1 = "B+p:ubYBGG0,|M3B=1*0N"
      let s2 = "it's touring complete"
      putStrLn $ map chr $ zipWith ((xor . subtract 10) `on` ord) s1 s2

Name: Anonymous 2009-11-29 15:45

forgot my [code]

main =
   do let s1 = "B+p:ubYBGG0,|M3B=1*0N"
      let s2 = "it's touring complete"
      putStrLn $ map chr $ zipWith ((xor . subtract 10) `on` ord) s1 s2

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List