diff --git a/2018/ciura/.gitignore b/2018/ciura/.gitignore index ea1749132..ffb16e793 100644 --- a/2018/ciura/.gitignore +++ b/2018/ciura/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2018/ciura/Makefile b/2018/ciura/Makefile index b7155bdaf..b0d62d20c 100644 --- a/2018/ciura/Makefile +++ b/2018/ciura/Makefile @@ -63,7 +63,7 @@ X11_INCDIR= /opt/X11/include # Common C compiler warnings to silence # #CSILENCE= -CSILENCE= -Wno-overlength-strings -Wno-shift-op-parentheses -Wno-unused-value +CSILENCE= -Wno-shift-op-parentheses -Wno-unused-value # Common C compiler warning flags # @@ -101,8 +101,8 @@ CINCLUDE= #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h -#CINCLUDE= -I ${X11_INCDIR} -#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 +#CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 +#CINCLUDE= `${SDL2_CONFIG} --cflags` # Optimization # @@ -126,7 +126,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL +#LIBS= `${SDL2_CONFIG} --libs` # C compiler to use # @@ -164,11 +164,12 @@ ENTRY= ciura PROG= prog # OBJ= ${PROG}.o +CSRC= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= ${PROG}.alt.o -ALT_TARGET= ${PROG}.alt +ALT_OBJ= +ALT_TARGET= ################# @@ -185,9 +186,6 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LIBS} -${PROG}.alt: ${PROG}.alt.c - ${CC} ${CFLAGS} $< -o $@ ${LIBS} - # alternative executable # alt: data ${ALT_TARGET} @@ -327,4 +325,3 @@ pluto: charon @echo "dwarf is a type of planet" @echo "therefore, $@ is a planet" @echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them" - diff --git a/2018/ciura/README.md b/2018/ciura/README.md index 83d7ffe1e..7e2760b2c 100644 --- a/2018/ciura/README.md +++ b/2018/ciura/README.md @@ -1,32 +1,41 @@ # Most likely to be awarded -Marcin Ciura -Twitter: @mciura + Marcin Ciura + Twitter: @mciura -## To build: +# To build: - make all +```sh +make +``` -### To run +### To run: - ./prog < text +```sh +./prog < text +``` ### Try: - ./prog < Makefile - ./prog < README.md +```sh +./prog < Makefile +./prog < README.md +``` -### Alternate code +### Alternate code: -An alternate version of this entry, prog.alt.c, is provided. As mentioned in the Author's comments, the alternate version lacks a useful bug fix. +An alternate version of this entry, `prog.alt.c`, is provided. +As mentioned in the Author's comments, the alternate version lacks a useful bug fix. To compile this alternate version: - make alt +```sh +make alt +``` Use `prog.alt` as you would `prog` above. -### Selected Judges Remarks: +## Judges' comments: This text was processed by prog. You may get confused. We're not really sure: prog.c wasn't commented. @@ -35,8 +44,7 @@ Having been written in C, how large of a vocabulary has it? ## Author's comments: -The Program -=========== +### The Program "The Elements of Style" by prof. William Strunk, Jr. and E. B. White is well known for its dislike of the passive voice. Direct, vigorous, @@ -63,8 +71,7 @@ initials. Both regular and irregular past participles are properly dealt with. Note that some words are red herrings: even though their ending is -ed, they are not past participles. -The Big String -============== +### The Big String Here is the purpose of every byte inside the **`c[]`** string: @@ -78,8 +85,7 @@ Here is the purpose of every byte inside the **`c[]`** string: adverbs, wh-words, and other words) and recognizing abbreviations - two type B state machines, called by **`V(808)`** and **`V(205)`**. -The State Machines -================== +### The State Machines I heard you don't like state machines so I put a state machine in your state machine so you can reject this entry while you reject this entry. @@ -88,8 +94,7 @@ Both types of state machines in the program are Mealy machines: we can think of their transitions as triples (**`transition_label`**, **`next_state`**, **`output`**). -Type A ------- +### Type A A state of type A state machine consists of eight transitions whose representations occupy consecutive bytes. The byte @@ -150,8 +155,7 @@ And here are sample steps of scanning tokens with classes **`to_be`**, * **`state`** = 22, **`transition_label`** = 0 (**`adverb`**), **`output`** = **`ignore`** * **`state`** = 22, **`transition_label`** = 3 (**`past_participle`**), **`output`** = **`passive_construction_end`** -Type B ------- +### Type B Type B state machines are built by a variant of the algorithm described in the paper @@ -228,8 +232,7 @@ And here are sample steps of scanning the string "i.e.": * **`state`** = 1, **`transition_label`** = 0 ('\0'), **`output`** = **`abbreviation`**. Return **`abbreviation`**. -Remarks -======= +### Remarks The judges found a bug in the handling of contractions: **`prog.alt.c`** outputs "foo wasn'**[t bazzed]**". I fixed the bug in **`prog.c`**, making @@ -249,11 +252,10 @@ I have tested it on: For a clean compile under c89 and c90, add **`-Woverlength-strings`** to **`CSILENCE`**. --------------------------------------------------------------------------------- -