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
)
60 srand((gettimeofday(&tv
,NULL
),tv
.tv_usec
));
63 while(fread(ch
,1,1,f
)) {
64 for(c
=0; c
<strlen(normal
); c
++) {
65 if(normal
[c
]==ch
[0]) {
67 case 4: if(nethack5
[c
]!=' ') ch
[0]=nethack5
[c
];
68 case 3: if(nethack4
[c
]!=' ') ch
[0]=nethack4
[c
];
69 case 2: if(nethack3
[c
]!=' ') ch
[0]=nethack3
[c
]; break;
70 case 1: if(nethack2
[c
]!=' ') ch
[0]=nethack2
[c
]; break;
71 case 0: ch
[0]=nethack1
[c
]; break;
80 for(i
=1; i
<argc
; i
++) {
This page took 0.022284 seconds and 4 git commands to generate.