Add 2020 source files for real
This commit is contained in:
1 parent
a3c1748648
commit
9d61fc0fb4
147 files changed
+32101
No files matched your search
@@ -0,0 +1,592 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2020 makefile
|
||||
#
|
||||
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
|
||||
# is licensed under:
|
||||
#
|
||||
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
#
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
#
|
||||
A2P= a2p
|
||||
AR= ar
|
||||
ASA= asa
|
||||
AT= at
|
||||
ATQ= atq
|
||||
ATRM= atrm
|
||||
AWK= awk
|
||||
BANNER= banner
|
||||
BASE64= base64
|
||||
BASENAME= basename
|
||||
BATCH= batch
|
||||
BC= bc
|
||||
BINHEX= binhex
|
||||
BISON= bison
|
||||
BUNZIP2= bunzip2
|
||||
BZCAT= bzcat
|
||||
BZCMP= bzcmp
|
||||
BZDIFF= bzdiff
|
||||
BZEGREP= bzegrep
|
||||
BZFGREP= bzfgrep
|
||||
BZGREP= bzgrep
|
||||
BZIP2= bzip2
|
||||
BZLESS= bzless
|
||||
BZMORE= bzmore
|
||||
C2PH= c2ph
|
||||
C89= c89
|
||||
C99= c99
|
||||
CAL= cal
|
||||
CALC= calc
|
||||
CAT= cat
|
||||
CD= cd
|
||||
CHFLAGS= chflags
|
||||
CHGRP= chgrp
|
||||
CHMOD= chmod
|
||||
CKSUM= cksum
|
||||
CLANG= clang
|
||||
CLANG_PLUSPLUS= clang++
|
||||
CLEAR= clear
|
||||
CMP= cmp
|
||||
COL= col
|
||||
COLLDEF= colldef
|
||||
COLRM= colrm
|
||||
COLUMN= column
|
||||
COMPRESS= compress
|
||||
CP= cp
|
||||
CPIO= cpio
|
||||
CPP= cpp
|
||||
CRC32= crc32
|
||||
CSH= csh
|
||||
CSPLIT= csplit
|
||||
CURL= curl
|
||||
CUT= cut
|
||||
C_PLUSPLUS= c++
|
||||
C_PLUSPLUS_FILT= c++filt
|
||||
DATE= date
|
||||
DC= dc
|
||||
DD= dd
|
||||
DF= df
|
||||
DIFF3= diff3
|
||||
DIFF= diff
|
||||
DIG= dig
|
||||
DIRNAME= dirname
|
||||
ECHO= echo
|
||||
ED= ed
|
||||
EGREP= egrep
|
||||
ENV= env
|
||||
EQN= eqn
|
||||
ETAGS= etags
|
||||
EXPECT= expect
|
||||
EXPR= expr
|
||||
FALSE= false
|
||||
FGREP= fgrep
|
||||
FILE= file
|
||||
FIND2PERL= find2perl
|
||||
FIND= find
|
||||
FLEX= flex
|
||||
FLEX_PLUSPLUS= flex++
|
||||
FMT= fmt
|
||||
FOLD= fold
|
||||
FS_USAGE= fs_usage
|
||||
FUNZIP= funzip
|
||||
FUSER= fuser
|
||||
GCC= gcc
|
||||
GDIFFMK= gdiffmk
|
||||
GENCAT= gencat
|
||||
GENSTRINGS= genstrings
|
||||
GETOPT= getopt
|
||||
GETOPTS= getopts
|
||||
GINDENT= gindent
|
||||
GNUMAKE= gnumake
|
||||
GREP= grep
|
||||
GROFF= groff
|
||||
GROFFER= groffer
|
||||
GROG= grog
|
||||
GROPS= grops
|
||||
GROTTY= grotty
|
||||
GUNZIP= gunzip
|
||||
GVIM= gvim
|
||||
GZCAT= gzcat
|
||||
GZEXE= gzexe
|
||||
GZIP_PROG= gzip
|
||||
G_PLUSPLUS= g++
|
||||
H2PH= h2ph
|
||||
H2XS= h2xs
|
||||
HASH= hash
|
||||
HEAD= head
|
||||
HOSTNAME_PROG= hostname
|
||||
ICONV= iconv
|
||||
ID= id
|
||||
INDENT= indent
|
||||
INFO= info
|
||||
JOT= jot
|
||||
KILL= kill
|
||||
KSH= ksh
|
||||
LAST= last
|
||||
LD= ld
|
||||
LESSECHO= lessecho
|
||||
LEX= len
|
||||
LINK= link
|
||||
LN= ln
|
||||
LS= ls
|
||||
M4= m4
|
||||
MAKE= make
|
||||
MAN= man
|
||||
MKDIR= mkdir
|
||||
MKFIFo= mkfifo
|
||||
MKTEMP= mktemp
|
||||
MV= mv
|
||||
NANO= nano
|
||||
NASM= nasm
|
||||
NEQN= neqn
|
||||
NICE= nice
|
||||
NL= nl
|
||||
NM= nm
|
||||
NOHUP= nohup
|
||||
NROFF= nroff
|
||||
NSLOOKUP= nslookup
|
||||
OD= od
|
||||
OPENSSL= openssl
|
||||
PASTE= paste
|
||||
PATCH= patch
|
||||
PATHCHK= pathchk
|
||||
PAX= pax
|
||||
PERL= perl
|
||||
PICO= pico
|
||||
PR= pr
|
||||
PRINTENV= printenv
|
||||
PS= ps
|
||||
PTAR= ptar
|
||||
PTARDIFF= ptardiff
|
||||
PTARGREP= ptargrep
|
||||
PWD= pwd
|
||||
PYDOC= pydoc
|
||||
PYTHON= python
|
||||
PYTHONW= pythonw
|
||||
READLINK= readlink
|
||||
RENICE= renice
|
||||
RESET= reset
|
||||
REV= rev
|
||||
RI= ri
|
||||
RM= rm
|
||||
RMDIR= rmdir
|
||||
RSYNC= rsync
|
||||
RUBY= ruby
|
||||
RVIM= rvim
|
||||
SAY= say
|
||||
SCP= scp
|
||||
SCREEN= screen
|
||||
SCRIPT= script
|
||||
SDIFF= sdiff
|
||||
SED= sed
|
||||
SEQ= seq
|
||||
SFTP= sftp
|
||||
SH= sh
|
||||
SHA1= sha1
|
||||
SHA= sha
|
||||
SHAR= shar
|
||||
SHASUM5_18= shasum5.18
|
||||
SHASUM= shasum
|
||||
SIZE= size
|
||||
SLEEP= sleep
|
||||
SORT= sort
|
||||
SSH= ssh
|
||||
STAT= stat
|
||||
STRIP= strip
|
||||
STTY= stty
|
||||
SUM= sum
|
||||
SYNC= sync
|
||||
TABS= tabs
|
||||
TAIL= tail
|
||||
TAR= tar
|
||||
TEE= tee
|
||||
TEST= test
|
||||
TFTP= tftp
|
||||
TIDY= tidy
|
||||
TIME= time
|
||||
TOP= top
|
||||
TOUCH= touch
|
||||
TPUT= tout
|
||||
TPUT= tput
|
||||
TR= tr
|
||||
TROFF= troff
|
||||
TRUE= true
|
||||
TSET= tset
|
||||
TSORT= tsort
|
||||
UL= ul
|
||||
UNAME= uname
|
||||
UNCOMPRESS= uncompress
|
||||
UNEXPAND= unexpand
|
||||
UNIFDEF= unifdef
|
||||
UNIFDEFALL= unifdefall
|
||||
UNIQ= uniq
|
||||
UNITS= units
|
||||
UNLINK= unlink
|
||||
UNZIP= unzip
|
||||
UNZIPSFX= unzipsfx
|
||||
UPTIME= uptime
|
||||
UUDECODE= uudecode
|
||||
UUENCODE= uuencode
|
||||
UUIDGEN= uuidgen
|
||||
VI= vi
|
||||
VIEW= view
|
||||
VIM= vim
|
||||
VIMDIFF= vimdiff
|
||||
W= w
|
||||
WAIT4PATH= wait4path
|
||||
WAIT= wait
|
||||
WC= wc
|
||||
WHAT= what
|
||||
WHATIS= whatis
|
||||
WHICH= which
|
||||
WHO= who
|
||||
WHOAMI= whoami
|
||||
WHOIS= whois
|
||||
WRTIE= write
|
||||
XAR= xar
|
||||
XARGS= xargs
|
||||
XATTR= xattr
|
||||
XXD= xxd
|
||||
YACC= yacc
|
||||
YES= yes
|
||||
ZCAT= zcat
|
||||
ZCMP= zcmp
|
||||
ZDIFF= zdiff
|
||||
ZEGREP= zegrep
|
||||
ZFGREP= zfgrep
|
||||
ZFORCE= zforce
|
||||
ZGREP= zgrep
|
||||
ZIP= zip
|
||||
ZIPCLOAK= zipcloak
|
||||
ZIPGREp= zipgrep
|
||||
ZIPINFo= zipinfo
|
||||
ZIPNOTE= zipnote
|
||||
ZIPSPLIT= zipsplit
|
||||
ZLESS= zless
|
||||
ZMORE= zmore
|
||||
ZNEW= znew
|
||||
ZPRINT= zprint
|
||||
ZSH= zsh
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
#X11_LIBDIR= /usr/X11R6/lib
|
||||
#X11_LIBDIR= /usr/X11/lib
|
||||
X11_LIBDIR= /opt/X11/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
#X11_INCDIR= /usr/X11R6/include
|
||||
#X11_INCDIR= /usr/X11/include
|
||||
X11_INCDIR= /opt/X11/include
|
||||
|
||||
# CWARN - Silence warnings that ${CWARN} would normally complain about
|
||||
# CSILENCE -Compiler warnings
|
||||
#
|
||||
ifeq ($(CC),clang)
|
||||
|
||||
# clang CSILENCE and CWARN
|
||||
#
|
||||
#CSILENCE=
|
||||
#CSILENCE= -Wno-implicit-int
|
||||
CSILENCE= -Wno-comma -Wno-empty-body -Wno-float-conversion -Wno-implicit-float-conversion \
|
||||
-Wno-missing-field-initializers -Wno-missing-prototypes -Wno-shadow -Wno-shorten-64-to-32 \
|
||||
-Wno-sign-conversion -Wno-vla -Wno-conversion -Wno-unknown-warning-option
|
||||
#
|
||||
#CWARN= $CSILENCE}
|
||||
#CWARN= -Wall $CSILENCE}
|
||||
#CWARN= -Wall -Wextra $CSILENCE}
|
||||
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra -Weverything $CSILENCE}
|
||||
CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE}
|
||||
|
||||
else
|
||||
ifeq ($(CC),gcc)
|
||||
|
||||
# gcc CSILENCE and CWARN
|
||||
#
|
||||
#CSILENCE=
|
||||
#CSILENCE= -Wno-implicit-int
|
||||
CSILENCE= -Wno-empty-body -Wno-missing-field-initializers -Wno-misleading-indentation \
|
||||
-Wno-unknown-warning-option
|
||||
#
|
||||
#CWARN= $CSILENCE}
|
||||
#CWARN= -Wall $CSILENCE}
|
||||
#CWARN= -Wall -Wextra $CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
else
|
||||
|
||||
# default CSILENCE and WARN
|
||||
#
|
||||
#CSILENCE=
|
||||
#CSILENCE= -Wno-implicit-int
|
||||
CSILENCE= -Wno-empty-body -Wno-missing-field-initializers \
|
||||
-Wno-misleading-indentation -Wno-unknown-warning-option
|
||||
#
|
||||
#CWARN= $CSILENCE}
|
||||
#CWARN= -Wall $CSILENCE}
|
||||
#CWARN= -Wall -Wextra $CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra -Weverything $CSILENCE}
|
||||
#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE}
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
# compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
#CSTD= -std=c11
|
||||
CSTD= -std=c99
|
||||
|
||||
# compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# defines that are needed to compile
|
||||
#
|
||||
CDEFINE=
|
||||
#CDEFINE= -DIOCCC
|
||||
|
||||
# include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
#CINCLUDE= -I ${X11_INCDIR}
|
||||
|
||||
# optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
#LIBS= -L ${X11_LIBDIR}
|
||||
|
||||
# ANSI compiler
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
#
|
||||
# If you do not have gcc, set CC to the name of your ANSI compiler, and
|
||||
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
|
||||
# to disable such programs.
|
||||
#
|
||||
CC= cc
|
||||
#CC= clang
|
||||
MAY_NEED_GCC= gcc
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
OBJ= prog.o
|
||||
DATA=
|
||||
TARGET= prog
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: ${TARGET} ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
prog: prog.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
${ECHO} ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
${ECHO} 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
nuke: clobber
|
||||
@${TRUE}
|
||||
|
||||
dist_clean: nuke
|
||||
@${TRUE}
|
||||
|
||||
install:
|
||||
@${ECHO} "Surely you are performing, Dr. Science!"
|
||||
@${TRUE}
|
||||
|
||||
# backwards compatibility
|
||||
#
|
||||
build: all
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to mis-understand the source by reading indent.c
|
||||
#
|
||||
indent.c: prog.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
${ECHO} ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
${ECHO} "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
${ECHO} ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
${ECHO} "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
${ECHO} "no intent prog found, ident $< yourself, sorry"; \
|
||||
${ECHO} "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@${ECHO} 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@${ECHO} 'haste'
|
||||
@${TRUE}
|
||||
|
||||
make:
|
||||
@${ECHO} 'We encourage you to attend a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@${ECHO} you expected to often mis-understand this $${RANDOM} magic
|
||||
@${ECHO} chongo '<was here>' "/\\oo/\\"
|
||||
@${ECHO} Eggy and Kitty
|
||||
|
||||
fabricate fashion form frame manufacture produce: make
|
||||
@${TRUE}
|
||||
|
||||
sandwich:
|
||||
@if [ `id -u` -eq 0 ]; then \
|
||||
${ECHO} 'Okay.'; \
|
||||
${ECHO} $${RANDOM}`date +%s`$${RANDOM} | \
|
||||
${SHASUM} -a 512256 | \
|
||||
${SED} -e 's/ .*//' > $@; \
|
||||
else \
|
||||
${ECHO} 'Reall?!? Make it yourself.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Understand the history of the Homebrew Computer Club
|
||||
# as well as the West Coast Computer Faire and
|
||||
# you might be confused different. :-)
|
||||
#
|
||||
supernova: nuke
|
||||
@-if [ -r .code_anal ]; then \
|
||||
${RM} -f .code_anal_v6; \
|
||||
else \
|
||||
${ECHO} "planet deniers, like a few silly IAU members, are so cute when they try to defend their logic"; \
|
||||
fi
|
||||
@${ECHO} A $@ helps ${MAKE} the elements that help form planets
|
||||
@${TRUE}
|
||||
|
||||
deep_magic:
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --deep_magic 253d8c80830e2df66c018820004b3d4939821bbd7d781fc50d9e633797e44f65d1d62c707bb7e5a82c328a37bbf9ecb4c46fb56aa3f08641fcf45d10ba3c6081 --FNV1a_hash_512_bit "prog"; \
|
||||
else \
|
||||
${ECHO} "Wrong! Do it again!"; \
|
||||
sleep 1; \
|
||||
${ECHO} "Wrong! Do it again!"; \
|
||||
sleep 1; \
|
||||
${ECHO} "Wrong! Do it again!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
magic: deep_magic
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --level 391581 --mode 216193 --state Riesel --FNV1a_hash_512_bit "prog"; \
|
||||
else \
|
||||
${ECHO} "If you don't eat yer meat, you can't have any pudding!"; \
|
||||
${ECHO} "How can you have any pudding if you don't eat yer meat?!"; \
|
||||
${ECHO} "p.s. Be cafeful with that axe, Eugene."; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
# The IOCCC resident astronomer states
|
||||
#
|
||||
charon: supernova
|
||||
@${ECHO} $@ is a dwarf planet
|
||||
@${ECHO} dwarf is a type of planet
|
||||
@${ECHO} therefore we continue to tell the IAU that $@ is a planet
|
||||
|
||||
pluto: supernova
|
||||
${MAKE} charon
|
||||
@${ECHO} $@ is a dwarf planet
|
||||
@${ECHO} dwarf is a type of planet
|
||||
@${ECHO} therefore, $@ is a planet
|
||||
@${ECHO} having lots of planets is good feature because $< can help ${MAKE} a lot of them
|
||||
@@ -0,0 +1,99 @@
|
||||
# Most misleading indentation
|
||||
|
||||
tsoj <tsoj.tsoj@gmx.de>
|
||||
<https://gitlab.com/tsoj>
|
||||
|
||||
|
||||
The code for this entry can be found in prog.c
|
||||
|
||||
## Judges' comments:
|
||||
### To use:
|
||||
|
||||
make
|
||||
./prog
|
||||
|
||||
|
||||
### Try:
|
||||
|
||||
# Make your terminal as large as possible, possibly reduce your font size
|
||||
# then...
|
||||
./prog
|
||||
|
||||
### Selected Judges Remarks:
|
||||
|
||||
This game does not use curses, but you may end up cursing.
|
||||
|
||||
The code is made more difficult to read using an innovative, right justified,
|
||||
reverse indentation style.
|
||||
|
||||
## Author's comments:
|
||||
#### Controls
|
||||
- Movement:
|
||||
`w`, `a`, `s`, `d`
|
||||
- Fire:
|
||||
`space`
|
||||
- Quit:
|
||||
`q`
|
||||
- Pause:
|
||||
`p`, then use any other key to resume
|
||||
|
||||
```
|
||||
/\
|
||||
//\\
|
||||
/ \
|
||||
/______\
|
||||
/\/\
|
||||
```
|
||||
#### Compile and run
|
||||
###### Linux
|
||||
```
|
||||
cc -std=c99 -O3 prog.c -o prog
|
||||
./prog
|
||||
```
|
||||
|
||||
###### Windows
|
||||
The only way I found to make it work is to use [MSYS2](https://www.msys2.org). When using the MSYS2 shell you can install gcc via pacman.
|
||||
```
|
||||
cc -std=c99 -O3 prog.c -o prog
|
||||
./prog.exe
|
||||
```
|
||||
#### Warnings
|
||||
- `-Wno-missing-prototypes`
|
||||
- `-Wno-shorten-64-to-32`
|
||||
- `-Wno-sign-conversion`
|
||||
- `-Wno-implicit-int-float-conversion`
|
||||
- `-Wno-missing-field-initializers`
|
||||
- `-Wno-implicit-float-conversion`
|
||||
- `-Wno-vla`
|
||||
- `-Wno-float-conversion`
|
||||
- `-Wno-comma`
|
||||
- `-Wno-shadow`
|
||||
- `-Wno-format`
|
||||
- `-Wno-empty-body`
|
||||
- `-Wno-misleading-indentation`
|
||||
- `-Wno-maybe-uninitialized`
|
||||
- You may experience a mild [motion aftereffect](https://en.wikipedia.org/wiki/Motion_aftereffect) when playing for too long
|
||||
#### Highscore
|
||||
Score will be shown in the top left corner.
|
||||
My best was **156**. If you beat that I'll send you the image of a very expensive chocolate.
|
||||
#### Features
|
||||
- Procedural star generation
|
||||
- Very space-efficient for-loops
|
||||
- No use of `!=` or `==`
|
||||
- Smooth rendering even on slow terminals
|
||||
- Advanced ascii-art
|
||||
- Cutting edge physics engine and collision detection
|
||||
- Probably not many segfaults
|
||||
- Every letter in the English alphabet has a variable or function named after it
|
||||
- Not a virus
|
||||
- Runs on my machine
|
||||
#### Tips
|
||||
- Adjust your terminal size for different experiences
|
||||
- Run this program in a virtual console to immerse yourself in the game
|
||||
-----------------------------------------------------------------------------------------------------
|
||||
(c) Copyright 1984-2020, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-----------------------------------------------------------------------------------------------------
|
||||
@@ -0,0 +1,151 @@
|
||||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional //EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.2.2">
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=utf-8"> <link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css" />
|
||||
<title></title>
|
||||
<title>Most misleading indentation</title>
|
||||
</head>
|
||||
<body>
|
||||
<CENTER>
|
||||
<IMG SRC="/png/ioccc.png" ALT="IOCCC" height=78 width=267>
|
||||
<P><FONT size="6"><I>The International Obfuscated C Code Contest</I></FONT></P>
|
||||
<div id="bar">
|
||||
<ul>
|
||||
<li><a href="../index.html">About the 27th IOCCC</a></li>
|
||||
<li><a href="../whowon.html">27th IOCCC Winners</a></li>
|
||||
<li><a href="/index.html">IOCCC home</a></li>
|
||||
<li><a href="/winners.html">List of All Winners</a></li>
|
||||
<li><a href="/judges.html">The Judges</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<P><FONT size="6"><B>A 27<sup>th</sup> IOCCC Winner</B></FONT></P>
|
||||
</CENTER>
|
||||
|
||||
|
||||
<h1>Most misleading indentation</h1>
|
||||
|
||||
<p>tsoj <a href="mailto:tsoj.tsoj@gmx.de">tsoj.tsoj@gmx.de</a><br/>
|
||||
<a href="https://gitlab.com/tsoj">https://gitlab.com/tsoj</a></p>
|
||||
|
||||
<p>The code for this entry can be found in <a href="prog.c">prog.c</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To use:</h3>
|
||||
|
||||
<pre><code>make
|
||||
./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code># Make your terminal as large as possible, possibly reduce your font size
|
||||
# then...
|
||||
./prog
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>This game does not use curses, but you may end up cursing.</p>
|
||||
|
||||
<p>The code is made more difficult to read using an innovative, right justified,
|
||||
reverse indentation style.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h4>Controls</h4>
|
||||
|
||||
<ul>
|
||||
<li>Movement:<br/>
|
||||
<code>w</code>, <code>a</code>, <code>s</code>, <code>d</code></li>
|
||||
<li>Fire:<br/>
|
||||
<code>space</code></li>
|
||||
<li>Quit:<br/>
|
||||
<code>q</code></li>
|
||||
<li>Pause:<br/>
|
||||
<code>p</code>, then use any other key to resume</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p><code>
|
||||
/\
|
||||
//\\
|
||||
/ \
|
||||
/______\
|
||||
/\/\
|
||||
</code></p>
|
||||
|
||||
<h4>Compile and run</h4>
|
||||
|
||||
<h6>Linux</h6>
|
||||
|
||||
<p><code>
|
||||
cc -std=c99 -O3 prog.c -o prog
|
||||
./prog
|
||||
</code></p>
|
||||
|
||||
<h6>Windows</h6>
|
||||
|
||||
<p>The only way I found to make it work is to use <a href="https://www.msys2.org">MSYS2</a>. When using the MSYS2 shell you can install gcc via pacman.
|
||||
<code>
|
||||
cc -std=c99 -O3 prog.c -o prog
|
||||
./prog.exe
|
||||
</code></p>
|
||||
|
||||
<h4>Warnings</h4>
|
||||
|
||||
<ul>
|
||||
<li><code>-Wno-missing-prototypes</code></li>
|
||||
<li><code>-Wno-shorten-64-to-32</code></li>
|
||||
<li><code>-Wno-sign-conversion</code></li>
|
||||
<li><code>-Wno-implicit-int-float-conversion</code></li>
|
||||
<li><code>-Wno-missing-field-initializers</code></li>
|
||||
<li><code>-Wno-implicit-float-conversion</code></li>
|
||||
<li><code>-Wno-vla</code></li>
|
||||
<li><code>-Wno-float-conversion</code></li>
|
||||
<li><code>-Wno-comma</code></li>
|
||||
<li><code>-Wno-shadow</code></li>
|
||||
<li><code>-Wno-format</code></li>
|
||||
<li><code>-Wno-empty-body</code></li>
|
||||
<li><code>-Wno-misleading-indentation</code></li>
|
||||
<li><code>-Wno-maybe-uninitialized</code></li>
|
||||
<li>You may experience a mild <a href="https://en.wikipedia.org/wiki/Motion_aftereffect">motion aftereffect</a> when playing for too long
|
||||
|
||||
<h4>Highscore</h4>
|
||||
|
||||
Score will be shown in the top left corner.<br/>
|
||||
My best was <strong>156</strong>. If you beat that I’ll send you the image of a very expensive chocolate.
|
||||
|
||||
<h4>Features</h4></li>
|
||||
<li>Procedural star generation</li>
|
||||
<li>Very space-efficient for-loops</li>
|
||||
<li>No use of <code>!=</code> or <code>==</code></li>
|
||||
<li>Smooth rendering even on slow terminals</li>
|
||||
<li>Advanced ascii-art</li>
|
||||
<li>Cutting edge physics engine and collision detection</li>
|
||||
<li>Probably not many segfaults</li>
|
||||
<li>Every letter in the English alphabet has a variable or function named after it</li>
|
||||
<li>Not a virus</li>
|
||||
<li>Runs on my machine
|
||||
|
||||
<h4>Tips</h4></li>
|
||||
<li>Adjust your terminal size for different experiences</li>
|
||||
<li>Run this program in a virtual console to immerse yourself in the game</li>
|
||||
</ul>
|
||||
|
||||
<BR>
|
||||
<HR>
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="/png/by-sa-3.0-88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2020,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
int t(){struct timeval t;gettimeofday(&t,0);return t.tv_usec/1000+t.tv_sec*1000;}
|
||||
|
||||
#define g(x,y,u,v,s)\
|
||||
for(int j=0,X=x,Y=y;j<v&&Y+j<h-X/w&&Y>=0&&X>=0;++j)memcpy(&f[Y+j][X],&s[j*u],u)
|
||||
#define l(x,y,w,h,a,b,c,d)\
|
||||
!((x-a>c&&x>=a)||(a-x>w&&a>=x)||(y-b>d&&y>=b)||(b-y>h&&b>=y))
|
||||
|
||||
int main(){
|
||||
struct termios z,o;tcgetattr(0,&z);o=z;z.c_lflag&=~ICANON&~ECHO;
|
||||
z.c_cc[VMIN]=0;z.c_cc[VTIME]=0;tcsetattr(0,TCSANOW,&z);
|
||||
srand(time(0));struct winsize v;ioctl(STDOUT_FILENO,TIOCGWINSZ,&v);
|
||||
int h=v.ws_row,w=v.ws_col,A=w*h/100,l=t(),k,s=0,g=1,i,c=0,L;
|
||||
struct V{float x,y;}p={w/2,h/2},b={-3*h},a[A],m[A];
|
||||
char*r=" /\\ /__\\ ^^ ",*n="o0o0OO",u=0,q,f[h+1][w];
|
||||
while(u^'q'){
|
||||
float d=(t()-l)*.001;
|
||||
q=u;do read(0,&u,1);while((u&'p')>=(u|'p'));
|
||||
l=t();c+=15;i=h*w-1;
|
||||
K:
|
||||
L=c*d;L=abs(((i/w)-L)*(i%w)+h*w);
|
||||
(*f)[i]=L%3+L%5+L%7+L%11+L%13+L%17+L%19>14?32:46;
|
||||
if(i--)goto K;
|
||||
u^' '?0:(b.x=p.x+2,b.y=p.y,u=q);
|
||||
q^'a'?q^'d'?q^'w'?q^'s'?0:
|
||||
(p.y+=d*15):
|
||||
(p.y+=d*-15):
|
||||
(p.x+=d*20):
|
||||
(p.x+=d*-20);
|
||||
p.x=p.x<0?0:p.x>=w-4?w-4:p.x;
|
||||
p.y=p.y<0?0:p.y>=h-3?h-3:p.y;
|
||||
b.y+=d*-20;
|
||||
int Y=b.y,X=b.x;Y*w+X>=0?f[Y][X]=64:0;
|
||||
i=A-1;
|
||||
L:
|
||||
k=0;struct V*e=&a[i],*z=&m[i];
|
||||
e->x+=d*z->x;e->y+=d*z->y;
|
||||
l(b.x,b.y,1,1,e->x,e->y,6,4)&&!g?k=1,s++,b.y=-3*h:0;
|
||||
e->x<0-3||e->x>=w+3||e->y>=h+2||k||g?
|
||||
e->y=-rand()%h*(1+g),
|
||||
e->x=rand()%w,
|
||||
z->x=-8+rand()%15,
|
||||
z->y=10+rand()%5:0;
|
||||
l(p.x,p.y,4,3,e->x,e->y,3,2)?u='q':0;
|
||||
g(e->x,e->y,3,2,n);
|
||||
if(i--)goto L;
|
||||
g(p.x,p.y,4,3,r);
|
||||
*(f[h])=0;
|
||||
printf("\033[0;4H%s\033[0;0H \033[4D%i\n",&f[0][4],s);
|
||||
while(t()-l<9);g=0;
|
||||
}
|
||||
tcsetattr(0,TCSADRAIN,&o);
|
||||
}
|
||||
Reference in new issue
Block a user