masklinn í dag viðrar vel til loftárása | Jubijub a écrit :
heu, je vous donne l'algo de MD5, je vous donne un hash, c pas pour autant que vous me retrouverez le truc de base hein ...(bon ok ca sert à rien pour assombrir du code mais le principe est le même)
|
Euh non, il n'y a strictement aucun lien entre MD5 et du cryptage, MD5 c'est du hashing t'es pas censé pouvoir retrouver le truc de base Par contre RSA (ou un autre système de crypto) là oui
mcjoedassin a écrit :
Jubijub> non, le principe n'est pas le même, disons que c'est plutôt comme crypter un programme avec une clef privée et donner la clef publique avec ... le programme que tu donnes doit être capable de se "reformer" en mémoire... je veux dire un code assombri doit être capable de se désassombrir de lui-même, c'est pour ça qu'un débugger contre ce genre de protection
|
Le code doit être informatiquement fonctionnel, ça ne veut absolument pas dire qu'il sera humainement compréhensible ou utilisable Exemples simples:
1- Hello World en brainfuck
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]
<.#>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>++++++++[
<++++>-]<+.[-]++++++++++. |
Il n'y a pas grand chose, et ça prend pourtant un moment à décoder
2- Réimplémentation de (a<b?a:b) en C (ah ben oui)
int mymax (int(*a)(int(*)(int(*)()),int(*)(int(*)(int**))), int(*b)(int(*)
(int(*)()),int*,int(*)(int(*)()))){return (int)((((int(*)(int(*)(int(*)()),int(
*)(int(*)())))a)> ((int(*)(int(*)(int(*)()),int(*)(int(*)())))b))?((int(*)(
int(*)(int(*)()),int(*)(int(*)())))a):((int(*)(int(*)(int(*)()),int(*)(int(*)(
))))b));??> |
qui s'appelle ainsi:
mymax((int(*)(int(*)(int(*)()),int(*)(int(*)(int**))))3,(int(*)(int(*)(int(*)
()),int*,int(*)(int(*)())))52); |
(remplace mymax(3,52)).
Le nom de fonction est ici explicite mais n'a bien sûr pas à l'être.
3- Implémentation de Quicksort...
a. En C
#include "stdio.h"
#include "stdlib.h"
#define U (
#define Y <<
#define A Y U
#define X [
#define Z ] #define W _ X #define V >>
#define D Y 1
#define P Z V #define S +1
#define v :
#define w ;
#define T -=
#define G W _
#define I ))
#define C D )-1
#define B V 1 I Z #define z 1 A 1
#define y + U 1 D )
#define r 1 D I y #define m U 1 A r #define p + U 1 t 1 I Z #define q X U z D I + U 1
#define s U 1 t 1) S )
#define t D ) P #define u 1) Z D #define F goto
#define E if
#define H P U #define R W m
#define J U R P
#define K P 1)
#define L U 1 Y #define M Z <=
#define Q R Z void quick_sort U int a X Z , int N, int O)
{
int W 1000 Z ;
W 1 Z = 1 w Q = W 1 Z Y W 1 Z w Q = _ q Y 1 ) Z Y W 1 Z w G X 1 P W 1 Z Z = W 1 P W
1 Z w W U Q C Z = W U z D I y Z Y W 1 Z w G X U R Z C Z Z = O w G X U Q C Z S Z = N
w G X U _ q Y u ) - 1 Z + J 1 ) Z = G X m H U W U z D ) ) + s Z w c v G q D ) Z S Z
= G X m H U W m K S ) Z + W U W U 1 A r Z C Z w G X U z D I + U 1 D ) Z - 1 Z = G X
Q S Z + U R H W U z D I p w G q D ) P 1 Z = G X Q S Z Z w _ X U R H W U z D ) ) p =
G X m P 1 Z - G X m Z - 1 Z w W U W m H _ q t 1 I Z
>>=
J J 1 I w W U W U 1 A r H Q B = a X W U R H W m Z B + G X U z Y 1 I y Z - 1 Z Z w h
v E U a X G X U z D I y Z - 1 Z Z >= W U Q V U Q B ) F i w G X m Z -1 Z += 1 w F
h w i v E U a X G X m H W L U r H R Z B M W U R H Q B ) F j w G X m H _ q t U Q B T
1 w F i w j v E U G X m Z - 1 Z > G X m H W U z Y 1 I + U 1 t J 1 I Z ) F b w G X m
Z Z = a X G X m Z - 1 Z Z w a X G X L U r Z - 1 Z Z = a X G X U z D I + U 1 t U R H
W U 1 A 1 D I p Z w G X U z D I y Z - 1 Z += 1 w a X G q t U R H W U 1 A 1 D I p Z
= G X U z D I y Z Z w G q t U R H Q B T 1 w b v E U G X m Z - 1 M _ X R H W U 1 A r
H W U z D I + U 1 t 1 I Z ) F h w E U G X W U 1 A r Z S Z + U W U z D I + U 1 t U W
U z D I + U 1 t 1 I Z >= G X U z D I + U 1 t U _ q D ) H R K ) Z ) F g w G q Y 1 )
H J 1 ) S ) Z += Q w G X m Z S Z = G X m H U W L U r K S ) Z + W U W U 1 A r Z C Z
w G X Q S Z Z = G X m H W U z D I + U 1 t U W U z D I + U 1 t 1 I Z w G X W U z D )
) y Z S Z + U _ q t U Q B = G X _ q Y 1 ) Z S Z - Q + U R H W U 1 A 1 D I p w G X _
X m Z S Z + U W U 1 A r H W U z D I + U 1 t U W U z D ) ) + U 1 t 1 I ) Z = U W U z
Y 1 I + U 1 t U W U z D I + U 1 t 1 I w F c w d v G X U 1 A r H U W U 1 A r K S ) Z
T W U 1 A r Z w g v E U G X R H U W U 1 A r K S ) Z + _ X U Q D ) - 1 Z M G q D ) Z
- 1 Z ) F f w G X U z D ) ) + U 1 t U U W U z D I + s Z += W U z Y 1 I y Z w G X U
z D I y Z S Z = G X U z D I + U 1 t U U W U z D I + U 1 t 1 ) S ) Z + W U W U z D I
+ L u ) - 1 Z w G X Q S Z Z = _ X G X m Z S Z - Q Z w G X Q S Z + U R H Q B = G q D
) Z - 1 Z w G X W U z D ) ) y Z S Z + U W U z D I + U 1 t U W U z D ) ) + U 1 t U W
U z D I + U 1 t 1 I ) Z = W U z D I + U 1 t U W U z D I + U 1 t U W U z D I + U 1 t
1 I w F c w e v G q t U U W U z D I + s Z T W U 1 A r Z w f v E U G X _ q t U U W U
z D ) ) + s Z + W U Q C Z + U W U z D ) ) + U 1 t U W U z D I + U 1 t U W U 1 A r P
1 I ) Z ==U W U z D I + U 1 t U W U z D I + U 1 t 1 I ) F d w E U G X W U 1 A r Z V
U U W U z D I + s Z + W U W U z D I + L u ) - 1 Z + U _ q Y 1 ) H W U z D I + U 1 t
U W U 1 A r Z V 1 I ) Z ==W U z D I + U 1 t U _ q Y 1 ) H W U z D I + U 1 t 1 I ) F
e w } |
b. En Java
import java.lang.*;
class quicksort
{
public quicksort(Object [] Q)
{
U = new Object[Q.length*2+100];
new A(Q,
new B(0,
new C(0,
new D(0,
new E(3,
new F(0,
new B(0,
new C(4,
new D(0,
new G(1,
new E(4,
new B(0,
new E(4,
new D(0,
new G(5,
new C(Q.length,
new B(0,
new C(4,
new D(0,
new G(1,
new E(4,
new B(0,
new E(4,
new D(0,
new C(6,
new H(0,
new C(2,
new D(0,
new C(4,
new B(0,
new C(4,
new D(0,
new G(6,
new E(0,
new I(Q,
new B(0,
new E(1,
new D(0,
new E(1,
new J(0,
new B(0,
new C(0,
new D(0,
new C(0,null))))))))))))))))))))))))))))))))))))))))))));}class J extends o{public J(int N,o O){
new L(
new K(0,null),
new C(0,(M<U.length)?
new J(0,
new C(0,
new B(0,
new C(0,
new D(0,
new G(1,
new E(0,
new B(0,
new E(0,
new D(0,
new C(0,null))))))))))):null));}}class L extends o{public L(o a, o b){}}class A extends o{public A(Object[]Q,o O){
new L(
new E(0,
new D(0,
new C(Q.length,null))),
new C(0,(M<R)?
new A(Q,
new B(0,
new C(0,
new D(0,
new G(1,
new E(0,
new P(Q,
new E(0,
new D(0,
new K(0,
new G(6,
new E(0,null)))))))))))):null));}}class S extends o{public S(int N,o O){U[N]=O;}}class T extends o{public T(int N, o O){M=compare(M,R);}}class V extends o{public V(int N,o O){
new E(1, new D(0, new K(0, new G(4, new E(4,null)))));
new C(0,((M==R)&&(U[5]==null))?
new V(0,
new L(
new K(0,
new G(2,
new E(4, new D(0,
new K(0,
new G(3,
new E(4,
new B(0,
new G(2,
new E(4,
new D(0,
new W(1,
new K(0,
new G(2,
new E(4,null))))))))))))))),
new C(M,(M==R)?
new B(0,
new G(4,
new E(4,
new D(0,
new E(4,null))))):
new L(
new T(0,
new K(0,
new K(0,
new G(2,
new E(4,
new D(0,
new E(1,null))))))),
new C(0,(M<0)?
new B(0,
new C(5,
new B(0,
new K(0,
new G(3,
new E(4,
new D(0,
new K(0,
new K(0,
new G(2,
new E(4,null))))))))))):null))))):null);}}class C extends o{public C(int N,o O){M = N;}}class B extends o{public B(int N,o O){U[M]=R;}}class H extends o{public H(int N,o O){U[M]=U[R];}}class P extends o{public P(Object[] Q,o O){Q[M]=R;}}class o extends Object{}class E extends o{public E(int N,o O){M=(Integer)U[N];}}class Y extends o{public Y(int N,o O){
new L(
new K(0,
new G(4,
new E(4,
new D(0,
new E(1,null))))),
new C(0,((M==R)&&(U[5]==null))?
new Y(0,
new L(
new K(0,
new G(3,
new E(4,
new D(0,
new K(0,
new G(2,
new E(4,
new B(0,
new G(3,
new E(4,
new D(0,
new G(1,
new K(0,
new G(3,
new E(4,null))))))))))))))),
new C(0,(M==R)?
new B(0,
new G(4,
new E(4,
new D(0,
new E(4, null))))):
new L(
new T(0,
new K(0,
new K(0,
new G(3,
new E(4,
new D(0,
new E(1, null))))))),
new C(0,(M>0)?
new H(0,
new C(5,
new D(0,
new C(1,
new B(0,
new K(0,
new G(2,
new E(4,
new D(0,
new K(0,
new K(0,
new G(3,
new E(4,null))))))))))))):null))))):null));}}class I extends o{public I(Object[] Q,o O){
new L(
new E(0, new D(0, new C(Q.length,null))),
new C(0,(M<R)?
new I(Q,
new B(0,
new C(0,
new D(0,
new G(1,
new E(0,
new B(0,
new G(6,
new E(0,
new X(Q,
new E(0,null))))))))))):null));}}class K extends o{public K(int N,o O){M=(Integer)U[M];}}class G extends o{public G(int N,o O){M+=N;}}class W extends o{public W(int N,o O){M-=N;}}class F extends o{public F(int N,o O){
new L(
new E(4,
new D(0,
new E(2,null))),
new C(0,(M!=R)?
new F(0,
new L(
new K(0,
new E(4,
new D(0,
new K(0,
new G(1,
new E(4,
new B(0,
new C(4,
new D(0,
new W(2,
new E(4,null))))))))))),
new C(0,(M<R)?
new B(0,
new C(4,
new D(0,
new G(4,
new E(4,
new B(0,
new G(2,
new E(4,
new D(0,
new G(1,
new K(0,
new G(2,
new E(4,
new B(0,
new G(1,
new E(4,
new D(0,
new W(1,
new K(0,
new G(2,
new E(4,
new B(0,
new G(3,
new E(4,
new D(0,
new K(0,
new G(1,
new E(4,
new B(0,
new K(0,
new G(2,
new E(4,
new D(0,
new E(1,
new Z(0, new H(0,
new G(4,
new E(4,
new D(0,
new C(1,
new B(0,
new G(2,
new E(4,
new D(0,
new K(0,
new G(1,
new E(4,
new B(0,
new G(3,
new E(4,
new D(0,
new W(1,
new K(0,
new E(4,
new B(0,
new C(1,
new D(0,
new K(0,
new K(0,
new G(1,
new E(4,null))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))):null))):null));}}protected Object[]U;class D extends o{public D(int N,o O){N=M;M=R;R=N;}}int M;class X extends o{public X(Object[]Q,o O){R=(Integer)Q[M];}}int R;class Z extends o{public Z(int N,o O){
new L(
new K(0, new G(4, new E(4, new D(0, new E(1, null))))),
new C(0,(M==R)?
new Z(0, new L(
new Y(0, new S(5, null)),
new V(0, new S(5, null)))):null));}
}
protected int compare(Object a,Object b)
{
return ((Integer)a).compareTo((Integer)b);
}
}
public class qs { public static void main(String[] args)
{
Integer [] test = new Integer[100];
for( int i = 0; i < test.length; i++ )
test[i] = (int) (Math.random() * 10000);
new quicksort(test);
for( int i = 0; i < test.length; i++ )
System.out.print(test[i] + "," );
System.out.println();
}
} |
c. En Python
import sys
funcs = range(10)
def A(_,o):
_[3]=_[5]()
def B(_,o):
o[_[2]]=_[9]()
def C(_,o):
_[3]=_[7]()
def D(_,o):
o[_[1]]=_[14]()
def E(_,o):
_[1]=_[4]()
def F(_,o):
_[2]=_[6]()
def G(_,o,O):
if _[O[0]]():return O[-1](_,o) or 1
def H(o, start, stop):
_=[o[stop],[lambda x,y:x+y,lambda x,y:x-y,lambda x,
y:y|1,0,0][1](start,funcs[4](range(funcs[3](),
len(o[:])))),stop,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(4,19):
_[i]=lambda _=_,o=o,s="reduce([lambda x,y:x+y,lambda "\
"x,y:x-y,lambda x,y:y|1,0,0][0],[_[1],funcs[4]("\
"range(eval(\"funcs[3]()\" ),_[10]()))])$funcs[4"\
"](range(eval(\"funcs[3]()\" ),_[10]()))$[lambda"\
" x,y:x+y,lambda x,y:x-y,lambda x,y:y|1,0,0][1]"\
"(_[2],funcs[4](range(funcs[3](),_[10]())))$fun"\
"cs[4](range(funcs[3](),_[10]()))$range(_[10]()"\
"*_[10]())$o[:][_[1]]$len(o[:])$not _[3]$_[1]=="\
"_[2]$o[:][_[1]]>_[0]$o[:][_[2]]$o[_[2]]<_[0]$_"\
"[2]==_[1]$_[11]() and not E(_,0) and not G(_,o"\
",[12,A]) and not G(_,o,[13,B])$_[11]() and not"\
" F(_,_) and not G(_,o,[16,C]) and not G(_,o,[1"\
"5,D])".split('$')[:][i-4]:eval("eval('eval(s)')" )
while _[11]():
while _[17](): pass
while _[18](): pass
o[_[2]] = _[0]
return _[2]
def quicksort(list,start,stop):
exec('funcs[3] = lambda:reduce([lambda x,y:x+y,lambda x,y'\
':x-y,lambda x,y:y|1,0,0][1],[[lambda x,y:x+y,lambda'\
' x,y:x-y,lambda x,y:y|1,0,0][2](200,200)]*2)\nfuncs'\
'[4] = lambda x:reduce(lambda x,y:y%2,range(eval("re'\
'duce([lambda x,y:x+y,lambda x,y:x-y,lambda x,y:y|1,'\
'0,0][2],[len(o[:]),len(o[:])])" ),eval("reduce([lamb'\
'da x,y:x+y,lambda x,y:x-y,lambda x,y:y|1,0,0][2],[l'\
'en(o[:]),len(o[:])])" )+((len(o)and 3)or 3)))\nif st'\
'art < stop:\n\tsplit = H(list, start, stop)\n\tquic'\
'ksort(list, start, [lambda x,y:x+y,lambda x,y:x-y,l'\
'ambda x,y: y|1,0,0][1](split,funcs[4](funcs[3]())))'\
'\n\tquicksort(list, reduce([lambda x,y:x+y,lambda x'\
',y:x-y,lambda x,y:y|1,0,0][0],[split,funcs[4](funcs'\
'[3]())]), stop)\n')
# test code: 20 elements to sort
list = []
import whrandom,time
for i in range(2000):
list.append(whrandom.randint(1,100))
start = time.clock()
quicksort(list,0,len(list)-1)
print "Sorting took %.2f" % (time.clock() - start)
# just a test loop to see if everything *is* sorted
element = -1
for i in list:
if i >= element:
element = i
else:
print "FUNK DAT: %20s" % str(i)
break |
4- Il n'y a même pas spécialement besoin de le vouloir, exemple avec une routine de string matching prenant en compte * (n caractères indéfinis) et ? (un unique caractère indéfini) tout en étant case insensitive
#include "stdio.h"
#include "stdlib.h"
int _[1000];
#define n(o) ; if(_[1]) goto o;
/* INPUT: l - pattern m - string to match against pattern
OUTPUT: TRUE if l matches m, FALSE otherwise.
*/
int match( const char* l, const char* m )
{
_[0]=0; _[_[0]+'0']=0; _[_[0]+'1']=0; _[_[0]+'2']=0; g:
_[_[0]+'3']=l[_[_[0]+'0']]; _[_[0]+'4']=m[_[_[0]+'1']];
_[_[0]+'5']=0; _[1]=_[_[0]+'3']!=0; n(d) _[_[0]+'5']=!_
[_[0]+'4']; _[1]=1; n(a) d: _[1]=_[_[0]+'3']!='*'; n(c)
_[0]+=6; _[_[0]+'0']=_[_[0]+'*']+1; _[_[0]+'1']=_[_[0]+
'+'];_[_[0]+'2']=1;_[1]=1;n(g)h:_[_[0]+'/']=_[_[0]+'5']
;_[1]=!(!_[_[0]+'/']&&_[_[0]-6+'4']);n(f)_[_[0]+'0']=_[
_[0]+'*'];_[_[0]+'1']=_[_[0]+'+']+1;_[_[0]+'2']=2;_[1]=
1;n(g)i:_[_[0]+'/']=_[_[0]+'5'];f:_[0]-=6;_[1]=1;n(a)c:
_[1]=_[_[0]+'3']!='?';n(b)_[1]=!_[_[0]+'4'];n(e)_[0]+=6
;_[_[0]+'0']=_[_[0]+'*']+1;_[_[0]+'1']=_[_[0]+'+']+1;_[
_[0]+'2']=3;_[1]=1;n(g)j:_[_[0]+'/']=_[_[0]+'5'];_[0]-=
6;e:_[1]=1;n(a)b:_[_[0]+'3']|=32;_[_[0]+'4']|=32;_[1]=_
[_[0]+'3']!=_[_[0]+'4'];n(a)_[0]+=6;_[_[0]+'0']=_[_[0]+
'*']+1;_[_[0]+'1']=_[_[0]+'+']+1;_[_[0]+'2']=4;_[1]=1;n
(g)k:_[_[0]+'/']=_[_[0]+'5'];_[0]-=6;a:_[2]=1;_[1]=_[_[
0]+'2']==_[2]++;n(h)_[1]=_[_[0]+'2']==_[2]++;n(i)_[1]=_
[_[0]+'2']==_[2]++;n(j)_[1]=_[_[0]+'2']==_[2]++;n(k)
return _[_[0]+'5'];
} |
5- On peut aussi calculer PI en C#
#region Using directives
using System;
using System.Collections;
using System.Text;
using System.Diagnostics;
#endregion
namespace pi
{
class pi
{
void LOOP()
{
Trace.Assert(!this == this - (!this + ~this));
Trace.Assert(this * (o[(this > !this) - !this]
* ((~this * ~this + !this) * ~this) + (this >
(this < (~this * ~this * ~this - !this)))) ==
(o[(this > !this) - !this] * ((~this * ~this
+ !this) * ~this) + (this > (this < (~this
* ~this * ~this - !this)))));
Trace.Assert(!this == this - (~this * ~this * ~this
- !this));
Trace.Assert(this * ((this < (!this + ~this)) /
((this > ~this) - !this)) == ((this <
(!this + ~this)) / ((this > ~this) - !this)));
Trace.Assert(~this == _((this < (!this + ~this))
% ((this > ~this) - !this)));
}
public string digits()
{
GOTO NOT = loop;
goto label0000;
label0013:
// This changes code-flow to label0000
goto label0014;
loop:
goto label0015;
label0016:
NOT = LOOP;
goto label0000;
label0002:
goto label0003;
label0004:
goto label0011;
label0012:
goto label0009;
label0010:
goto label0007;
label0008:
if ((this < (~this * ~this + !this + !this)) !=
((~this * ~this + !this) * ~this))
goto label0017;
Trace.Assert(this >= (~this * ~this + !this + !this));
goto label0001;
label0017:
if ((this < (~this * ~this)) == (!this - !this))
goto label0018;
s.Append((this < (~this * ~this * ~this)).ToString());
label0018:
Trace.Assert(null != new pi[3] { new pi(this % (this < ~this)), new pi(this * ((this < !this) + !this))
, new pi(this % (this > !this)) });
if (this / +this)
goto loop;
return s.ToString();
label0000:
Trace.Assert(this <= (int)this);
LOOP:
NOT();
goto label0005;
label0006:
if ((this > !this) > (!this - !this))
goto LOOP;
if (NOT == loop)
goto label0013;
goto label0002;
label0001:
Trace.Assert(!this == this - (~this * ~this * ~this));
new pi(this * ((this < (~this * ~this * ~this)) + !this));
goto label0017;
label0003:
Trace.Assert(!this == this - (~this * ~this * ~this));
goto label0004;
label0005:
Trace.Assert(!this == this - (~this * ~this + !this));
new pi(this * ((this > !this) - !this));
goto label0006;
label0007:
Trace.Assert(this * ((this < (~this * ~this * ~this - !this))
% ((~this * ~this + !this) * ~this))
== ((this < (~this * ~this * ~this
- !this)) % ((~this * ~this + !this) * ~this)));
goto label0008;
label0009:
Trace.Assert(this * ((this < (~this * ~this))
+ ((this < (~this * ~this * ~this - !this))
/ ((~this * ~this + !this) * ~this)))
== ((this < (~this * ~this)) + ((this < (~this * ~this
* ~this - !this)) / ((~this * ~this + !this) * ~this))));
Trace.Assert(!this == this - (~this * ~this));
goto label0010;
label0011:
Trace.Assert(this * (this < (~this * ~this + !this + !this))
== (this < (~this * ~this + !this + !this)));
Trace.Assert(!this == this - (~this * ~this + !this + !this));
goto label0012;
label0014:
Trace.Assert(!this == this - !this);
Trace.Assert(this * (!this - !this) == (!this - !this));
goto loop;
label0015:
Trace.Assert(!this == this - (~this * ~this * ~this - !this));
Trace.Assert(this * (!this - !this) == (!this - !this));
goto label0016;
} int[] o = null;
public static int operator +(pi _, int o)
{
return _.o[_.o.Length - o];
}
public static int operator -(pi _, int o)
{
_.O.Push(o);
return !_;
}
public static int operator *(pi _, int o)
{
_.o[_.o.Length - (int)_.O.Pop()] = o;
return o;
}
public static bool operator /(pi _, int o)
{
return _.o[_.o.Length - (int)_.O.Pop()] < o;
}
public static int operator !(pi _)
{
return 1;
}
public static int operator +(pi _)
{
return _.o[_.o.Length - ~_];
}
public static int operator %(pi _, int o)
{
return _ - !_;
}
public pi(int _)
{
o = new int[_ * ((~this * ~this + !this) * ~this)
/ (!this + ~this) + 60];
o[o.Length - ~this] = _ + ~this;
}
public static implicit operator int(pi _)
{
return ((+_) * ((~_ * ~_ + !_) * ~_)) / (~_ + !_);
}
public static int operator ~(pi _)
{
return !_ + !_;
}
public static implicit operator string(pi _)
{
return _.digits();
}
public static bool operator <=(pi _, int o)
{
Trace.Assert(_ - (~_ * ~_ + !_) == !_);
o = _ * o;
return true;
}
Stack O = new Stack();
public static bool operator >=(pi _, int o)
{
Trace.Assert(_ - o == !_);
return (_ * (!_ - !_)) == (!_ - !_);
}
public static int operator <(pi _, int o)
{
return _.o[_.o.Length - o];
}
public static int operator >(pi _, int o)
{
return (_ < (~_ * ~_ + !_)) * o;
}
int _(int _)
{
o[(this > !this) - !this] = _;
return ~this;
}
public delegate void GOTO();
StringBuilder s = new StringBuilder();
void loop()
{
_(~this);
}
} // end of class.
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine((string)new pi(20));
}
}
} |
Plus généralement, tu peux aller voir du côté de l'International Obfuscated C Code Contest pour voir des codes parfaitement lisibles par les machines (et fonctionnels) tout en restant garantis imbitables humainement parlant, certains allant jusqu'à finement utiliser les espaces vides pour créer des formes troublant encore plus le lecteur, comme Arachnid de l'IOCCC 17:
#include <ncurses.h>/*****************************************************/
int m[256 ] [ 256 ],a
,b ;;; ;;; WINDOW*w; char*l="" "\176qxl" "q" "q" "k" "w\
xm" "x" "t" "j" "v" "u" "n" ,Q[
]= "Z" "pt!ftd`" "qdc!`eu" "dq!$c!nnwf"/** *** */"t\040\t";c(
int u , int v){ v?m [u] [v-
1] |=2,m[u][v-1] & 48?W][v-1 ] & 15]]):0:0;u?m[u -1][v]|=1 ,m[
u- 1][ v]& 48? W-1 ][v ]&
15] ]):0:0;v< 255 ?m[ u][v+1]|=8,m[u][v+1]& 48? W][ v+1]&15]]
):0 :0; u < 255 ?m[ u+1 ][v ]|=
4,m[u+1][ v]&48?W+1][v]&15]]):0:0;W][ v]& 15] ]);}cu(char*q){ return
*q ?cu (q+ 1)& 1?q [0] ++:
q[0 ]-- :1; }d( int u , int/**/v, int/**/x, int y){ int
Y=y -v, X=x -u; int S,s ;Y< 0?Y =-Y ,s,
s=- 1:( s=1);X<0?X=-X,S =-1 :(S= 1); Y<<= 1;X<<=1; if(X>Y){
int f=Y -(X >>1 );; while(u!= x){
f>= 0?v+=s,f-=X:0;u +=S ;f+= Y;m[u][v]|=32;mvwaddch(w,v ,u, m[u
][ v]& 64? 60: 46) ;if (m[ u][
v]&16){c(u,v);; ;;; ;;; return;}} }else{int f=X -(Y>>1);; while
(v !=y ){f >=0 ?u +=S, f-= Y:0
;v +=s ;f+=X;m[u][v]|= 32;mvwaddch(w,v ,u,m[u][v]&64?60:46);if(m[u
][ v]& 16) {c( u,v );
; return;;;}}}}Z( int/**/a, int b){ }e( int/**/y,int/**/ x){
int i ; for (i= a;i <=a
+S;i++)d(y,x,i,b),d(y,x,i,b+L);for(i=b;i<=b+L;i++)d(y,x,a,i),d(y,x,a+ S,i
); ;;; ;;; ;;; ;;; ;
mvwaddch(w,x,y,64); ;;; ;;; ;;; prefresh( w,b,a,0,0 ,L- 1,S-1
);} main( int V , char *C[
] ){FILE*f= fopen(V==1?"arachnid.c"/**/ :C[ 1],"r" );int/**/x,y,c,
v=0 ;;; initscr (); Z(Z (raw
() ,Z( curs_set(0),Z(1 ,noecho()))),keypad( stdscr,TRUE));w =newpad
( 300, 300 ) ; for (x= 255 ; x >=0 ;x--
) for (y= 255 ;y>=0;y-- )m[ x][ y]= 0;x=y=0;refresh( );while
( (c= fgetc (f) )+1) {if(
0||c==10|| x== 256){x=0;y++;if(y==256 )break;;} else{m[x][y]=(c ==
'~' ?64 : c ==32 ?0: 16) ;;x ++;
}}for(x=0 ;x< 256;x++)m [x][0]=16 ,m[ x][ 255]=16;for(y=0
;y< 256 ; y ++) m[0 ][y ] = 16,
m[255][y] =16 ;a=b=c=0; x=y =1; do{v++;mvwaddch (w, y,x ,m[
x][ y]& 32? m[x ][y ] & 16?
0| acs_map[l[m[x][y]&15]]:46 : 32);c==0163&&!(m[x][y+1]&16)?y++: 0;c
== 119 &&! (m[ x][
y- 1]& 16) ?y--:0;;c ==97 &&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1
][ y]& 16) ? x ++:0 ;if( c==
3- 1+1 ){endwin( );; return(0) ;}x -a<5?a>S- 5?a-=S-5:(a=0):
0;x -a> S-5?a<255 -S* 2?a +=S
-5:(a=256-S):0; y-b<5?b>L-5?b-=L-5:(b =0) :0; y-b>L-5?b<255-L *2?
b+= L-5 :(b =256
-L) :0;e(x,y);if(m[x][y]&64)break;}while((c=getch())!=-1);endwin();cu(Q);
printf(Q,v);} |
Message édité par masklinn le 02-08-2005 à 22:19:35 ---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
|