]>
iEval git - filters.git/blob - nethackify.c
4 tries to write text ala nethack
6 cat /etc/motd/ | nethackify
7 /exec -o nethackify "good morning :)"
17 char *normal
="ABCDEFGHIKLMNOPQRTUVWZbdeghjklmnoqwy:;01678";
18 char *nethack1
="^P(|||C||||||CFCP|J/V/|cccni||nrccvv.,C|o/3";
19 char *nethack2
="?b?)F-(-?<_??(?(F???/??|??????r???????(???o";
20 char *nethack3
=" [ [L \\ ";
21 char *nethack4
=" [ \\ ";
22 char *nethack5
=" _ \\ ";
24 int myrandom(float max
)
26 return ((int)(max
*rand()/(RAND_MAX
+1.0)));
29 void nethackify(char* str
)
32 for(i
=0; i
<strlen(str
); i
++) {
33 for(c
=0; c
<strlen(normal
); c
++) {
34 if(normal
[c
]==str
[i
]) {
37 case 4: if(nethack5
[c
]!=' ') str
[i
]=nethack5
[c
];
38 case 3: if(nethack4
[c
]!=' ') str
[i
]=nethack4
[c
];
39 case 2: if(nethack3
[c
]!=' ') str
[i
]=nethack3
[c
]; break;
40 case 1: if(nethack2
[c
]!=' ') str
[i
]=nethack2
[c
]; break;
41 case 0: str
[i
]=nethack1
[c
]; break;
53 int main(int argc
, char **argv
)
58 srand((gettimeofday(&tv
,NULL
),tv
.tv_usec
));
60 while((ch
= getchar()) != EOF
) {
61 for(c
=0; c
<strlen(normal
); c
++) {
64 case 4: if(nethack5
[c
]!=' ') ch
=nethack5
[c
];
65 case 3: if(nethack4
[c
]!=' ') ch
=nethack4
[c
];
66 case 2: if(nethack3
[c
]!=' ') ch
=nethack3
[c
]; break;
67 case 1: if(nethack2
[c
]!=' ') ch
=nethack2
[c
]; break;
68 case 0: ch
=nethack1
[c
]; break;
76 for(i
=1; i
<argc
; i
++) {
This page took 0.047367 seconds and 4 git commands to generate.