Congratulations to: * 2024/anders - Prize in sound coding - layered music generator * 2024/burton - Prize in pentagrammatology - wordle hard mode solver * 2024/cable1 - Prize in bot talk - LLM inference engine * 2024/cable2 - Prize in murky waters - salmon recipe * 2024/carlini - Prize in perfect timing - Intel 4004 emulation * 2024/codemeow - Prize in tray planting - bonsai generator * 2024/endoh1 - Prize in patient pointillism - slow ray tracer in CPP * 2024/endoh2 - Prize in solid body physics - rotating rigid body simulation * 2024/ferguson1 - Prize in diabolical logistics - Oregon trail pact with the devil * 2024/ferguson2 - Prize in yil-tas - Navajo code talker translator * 2024/howe - Nice accent eh-ward - mini vi * 2024/kramer - Prize in linguistic arithmetic - natural language numerical calculator * 2024/kurdyukov1 - Prize in phased periodicity - phase of the Moon * 2024/kurdyukov2 - Prize in art restoration - JPEG artifact removal * 2024/kurdyukov3 - Prize in virtual quietus - gaming VM and doom * 2024/kurdyukov4 - Prize in embiggening - encode without literals * 2024/maffiodo - Prize in creative interpretation - Jav\*script interpreter * 2024/mills - Prize in ℤ₃ - Infocom v3 story interpreter * 2024/stedolan - Best one liner - icon from MD5 * 2024/straadt - Prize in imitative rebooting - OpenRISC CPU and Linux * 2024/tmarrec - Prize in cyclonic coding - 3D tornado simulation * 2024/tompng - Prize in quasi bijection - vortex encryptor decryptor * 2024/weaver - Sur prize - rickroll Ran `make update` to perform the above. new file: 2024/burton/.entry.json
599 lines
4.9 KiB
C
599 lines
4.9 KiB
C
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
#ifndef DICT
|
|
#define DICT "dict"
|
|
#endif
|
|
#define X 0
|
|
struct a {
|
|
char *w,
|
|
*c,*s,
|
|
*x, *t,
|
|
*u,**h,*S,
|
|
*N,
|
|
*A,
|
|
*(
|
|
*v
|
|
|
|
[9])
|
|
|
|
(struct a
|
|
|
|
*),*y; struct a *e, *a, *z,*k,*j;
|
|
|
|
int l;
|
|
|
|
} *f, *c;
|
|
|
|
char *B[][2] = { { "A", "WOL-LA-CHEE" } ,
|
|
{ "B", "SHUSH" } , { "C", "MOASI" } , { "D", "CHINDI" } ,
|
|
{ "E", "DZEH" } , { "F", "CHUO" } , { "G", "JEHA" } , { "H", ""
|
|
"TSE-GAH" } , { "I", "YEH-HES" } , { "J", "AH-YA-TSINNE" } , { "K",
|
|
"BA-AH-NE-DI-TININ" } , { "L", "NASH-DOIE-TSO" } , { "M", ""
|
|
"BE-TAS-TNI" } , { "N", "TSAH" } , { "O", "A-KHA" } ,{ "P"
|
|
, "CLA-GI-AIH" } , { "Q", "CA-YEILTH" } , { "R",
|
|
"DAH-NES-TSA" } , { "S", "KLESH" } ,{ "T",
|
|
"D-AH" } , { "U", "NO-DA-IH" } , { "V",
|
|
"A-KEH-DI-GLINI" } ,{ "W", "GLOE-IH"
|
|
} , { "X", "AL-NA-AS-DZOH" } ,{ "Y",
|
|
"TSAH-AS-ZIH" } , { "Z",
|
|
|
|
|
|
"BESH-DO-TLIZ" } , } , *Y(struct a *) ;
|
|
int z,
|
|
J,
|
|
C,
|
|
k,
|
|
H,
|
|
D,
|
|
L,
|
|
s;
|
|
size_t n,
|
|
o;
|
|
FILE *g;
|
|
char *I
|
|
(struct a
|
|
|
|
*a) { for (a
|
|
->a
|
|
= a->z,
|
|
z =
|
|
0*
|
|
*""
|
|
"1"; a
|
|
-> a; a ->
|
|
|
|
a = a->a->e) {
|
|
if (
|
|
a ->
|
|
v [2
|
|
] (
|
|
& (
|
|
struct a) { .
|
|
w=a->a->w,.c=a
|
|
|
|
->x} )){ while(
|
|
!isalpha (*a
|
|
->x)
|
|
&&*
|
|
(a->
|
|
x)){
|
|
L=putchar (*a
|
|
->x); ++a->x; }
|
|
|
|
while ((z++)[a->
|
|
a->c])
|
|
s=z+
|
|
-*"1"
|
|
-*"1"
|
|
- -
|
|
97,L
|
|
= putchar (!s &&
|
|
|
|
isupper(a->x[0*
|
|
*"z"
|
|
])?a
|
|
->a
|
|
->c
|
|
[s]:
|
|
tolower (a->
|
|
a->c[s])); goto
|
|
|
|
n; } } for (z =
|
|
2/
|
|
*
|
|
"z",
|
|
s=
|
|
1+0
|
|
**
|
|
"1"; z[a->x]; ++z)
|
|
|
|
{ if (!isalpha(z[a
|
|
->
|
|
x]
|
|
))
|
|
L=putchar (z
|
|
[a
|
|
->
|
|
x]) ; else { C =
|
|
|
|
islower (z[a->x]); for(J
|
|
=*
|
|
"1"
|
|
-*
|
|
"1"
|
|
; J
|
|
<26
|
|
&& B[J][X?1/ *
|
|
|
|
"1"+s/ *"1"+1/ *
|
|
"1"+s/ *
|
|
"1" +
|
|
1+ (s
|
|
-s) **
|
|
"1" +(
|
|
s* (s
|
|
-s))**"1":((((s-1
|
|
|
|
)**"1")**"1")**"1"
|
|
)**
|
|
"1"
|
|
] ;
|
|
++J)
|
|
{if
|
|
(*B
|
|
[J][0+*"1"-*"1"]==
|
|
|
|
|
|
toupper(z[a->x]))
|
|
{
|
|
for (k = (s*2) **
|
|
"9"
|
|
-171+*"9"; H=B[J][
|
|
X?*
|
|
"1"
|
|
-49:s/ *"1"+s/ *"1"
|
|
+1/
|
|
*"1"+(s*s*s)][ k];
|
|
++
|
|
k) putchar (C
|
|
?
|
|
tolower(H)
|
|
: toupper(H));
|
|
|
|
L
|
|
=
|
|
|
|
putchar(
|
|
(
|
|
'\0'
|
|
+
|
|
|
|
'!'
|
|
|
|
-
|
|
|
|
1
|
|
|
|
));
|
|
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
n
|
|
|
|
:
|
|
if
|
|
(
|
|
!
|
|
|
|
isspace(
|
|
|
|
L
|
|
)
|
|
)
|
|
|
|
|
|
putchar
|
|
(
|
|
|
|
' '
|
|
);
|
|
|
|
|
|
|
|
return a->s;
|
|
|
|
|
|
}
|
|
|
|
char
|
|
|
|
|
|
|
|
*
|
|
Z
|
|
(
|
|
struct
|
|
a
|
|
*
|
|
|
|
a)
|
|
|
|
{
|
|
|
|
while
|
|
(
|
|
|
|
a
|
|
->
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|
-
|
|
|
|
'*'))]:D[a
|
|
|
|
->s]); ++D) ; return a?a->s:"";
|
|
|
|
} char *Y(struct a *a) { if (*a->w && *a->c && a->w[1] && a->c[1])
|
|
while (*a->w && *a->c) { while (!isalpha(*a->w) && *a->w++);
|
|
|
|
|
|
while (!isalpha(*a->c) && *a->c++); if (!*a->c || !*a->w || tolower(*a->w) != tolower(*a->c))
|
|
break;
|
|
++
|
|
|
|
a
|
|
->
|
|
w;
|
|
|
|
++
|
|
a->c; }
|
|
return !
|
|
*
|
|
a
|
|
->
|
|
w
|
|
&&
|
|
!
|
|
*
|
|
a
|
|
->
|
|
|
|
c
|
|
?
|
|
|
|
"":0;
|
|
} char
|
|
|
|
|
|
*
|
|
|
|
|
|
F
|
|
|
|
|
|
(struct a *a) { g = fopen(DICT, "r"); if (g) { while (getline(&a
|
|
->A,
|
|
&
|
|
n,
|
|
g) !=
|
|
-
|
|
|
|
1) if ((a->N = strtok(a->A, "\t")) && (a->S = strtok(0, "\t"))) {
|
|
|
|
|
|
c = calloc(1**"0"-47, sizeof *c);
|
|
c->w = strdup(X?a->v[a->l](&(struct a){ .s=a->S} ):a->v[a->e==0](&(struct a){ .s=a->N} ));
|
|
c->c = strdup(X?a->v[1](&(struct a){ .s=a->N} ):a->v[a->l](&(struct a){ .s=a->S} ));
|
|
c->e = f;
|
|
f = c;
|
|
}
|
|
|
|
free(a->A);
|
|
a->A = 0;
|
|
|
|
fclose
|
|
|
|
(
|
|
|
|
g
|
|
|
|
|
|
) ;
|
|
g = 0; }
|
|
else
|
|
puts
|
|
(
|
|
|
|
|
|
"couldn't open dict");
|
|
|
|
|
|
return""
|
|
|
|
; }
|
|
|
|
char
|
|
|
|
*
|
|
|
|
t
|
|
|
|
(struct a
|
|
*
|
|
|
|
a
|
|
)
|
|
{
|
|
o =
|
|
|
|
*
|
|
|
|
"";
|
|
|
|
g = fopen(a
|
|
|
|
->s,
|
|
"r"); a->A = 0; while (g && getline(&a->A, &o, g) != -1) { a->S = strtok(a
|
|
|
|
->A
|
|
|
|
,
|
|
|
|
" \t");
|
|
while (a->S) if ((a->y=strdup(a->S))) {
|
|
|
|
(
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
|
|
a
|
|
|
|
->
|
|
v
|
|
|
|
|
|
)(
|
|
|
|
&
|
|
|
|
(struct a){
|
|
|
|
.
|
|
|
|
|
|
v
|
|
[
|
|
2
|
|
]
|
|
|
|
|
|
=Y,
|
|
|
|
.
|
|
|
|
x=a->y} ); a->S = strtok(0, " \t"); free(a->y); a->y=0; if (!isspace(L))putchar(' ');
|
|
} } if(g) { clearerr(g); fclose(g); g = 0; free(a->A); a->A= 0; } return "";
|
|
}
|
|
int main(int c, char **a)
|
|
{
|
|
|
|
|
|
F
|
|
(
|
|
(
|
|
c
|
|
|
|
=
|
|
|
|
(
|
|
|
|
(
|
|
|
|
|
|
~
|
|
|
|
|
|
~
|
|
|
|
!
|
|
|
|
! ~
|
|
|
|
! 9u |
|
|
2
|
|
* *
|
|
|
|
"9"-15u/
|
|
*"0"-2u)<<
|
|
~
|
|
~
|
|
!
|
|
~
|
|
!
|
|
~9u),c
|
|
&=
|
|
9u,
|
|
&(struct a){.l=1, .s=a[c],.v= { &w, &w } } ));
|
|
Z(&(struct a){ .v = { t, I } ,.k=0, .l=c, .h=a, .j=f} );
|
|
puts(""); }
|