release winning entries of IOCCC28 under the year 2024
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
This commit is contained in:
1 parent
10512e6c79
commit
09750f8899
443 files changed
+182938
-231
No files matched your search
@@ -0,0 +1,313 @@
|
||||
{
|
||||
"no_comment" : "mandatory comment: because comments were removed from the original JSON spec",
|
||||
"entry_JSON_format_version" : "1.2 2024-09-25",
|
||||
"award" : "Prize in diabolical logistics",
|
||||
"year" : 2024,
|
||||
"dir" : "ferguson1",
|
||||
"entry_id" : "2024_ferguson1",
|
||||
"title" : "oregon",
|
||||
"abstract" : "Oregon trail pact with the devil",
|
||||
"author_set" : [
|
||||
{
|
||||
"author_handle" : "Cody_Boone_Ferguson"
|
||||
}
|
||||
],
|
||||
"manifest" : [
|
||||
{
|
||||
"file_path" : "prog.c",
|
||||
"inventory_order" : 20,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "entry source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "Makefile",
|
||||
"inventory_order" : 30,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "makefile",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "entry Makefile"
|
||||
},
|
||||
{
|
||||
"file_path" : "prog.alt.c",
|
||||
"inventory_order" : 40,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "alternate source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "prog.orig.c",
|
||||
"inventory_order" : 50,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "original source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "commented.c",
|
||||
"inventory_order" : 90,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "commented version of the game"
|
||||
},
|
||||
{
|
||||
"file_path" : "addpadding.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "add padding from data source files"
|
||||
},
|
||||
{
|
||||
"file_path" : "bytecheck.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "read data.src and print out single-byte chars"
|
||||
},
|
||||
{
|
||||
"file_path" : "bytecount.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "print each string with locations"
|
||||
},
|
||||
{
|
||||
"file_path" : "byteread.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "prints out the strings without locations"
|
||||
},
|
||||
{
|
||||
"file_path" : "bytetest.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "prints every string extracted from data"
|
||||
},
|
||||
{
|
||||
"file_path" : "deobfuscation.html",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "markdown",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "hints on how to deobfuscate"
|
||||
},
|
||||
{
|
||||
"file_path" : "lencount.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "counts strings and reports longest one"
|
||||
},
|
||||
{
|
||||
"file_path" : "mbcheck.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "show location of multibyte characters"
|
||||
},
|
||||
{
|
||||
"file_path" : "obfuscation.html",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "markdown",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "obfuscation information"
|
||||
},
|
||||
{
|
||||
"file_path" : "printer.c",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "prints strings like the game does"
|
||||
},
|
||||
{
|
||||
"file_path" : "try.sh",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "shellscript",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "script to try entry"
|
||||
},
|
||||
{
|
||||
"file_path" : "devil.png",
|
||||
"inventory_order" : 125,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "image",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "Devil driving wagon"
|
||||
},
|
||||
{
|
||||
"file_path" : "gotos.png",
|
||||
"inventory_order" : 125,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "image",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "Devil regretting gotos"
|
||||
},
|
||||
{
|
||||
"file_path" : "ioccc.jpg",
|
||||
"inventory_order" : 125,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "image",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "image that might or might not be true"
|
||||
},
|
||||
{
|
||||
"file_path" : "spaghetti.png",
|
||||
"inventory_order" : 125,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "image",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "use a goto and this might happen"
|
||||
},
|
||||
{
|
||||
"file_path" : "travelguide.jpg",
|
||||
"inventory_order" : 125,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "image",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "travel guide"
|
||||
},
|
||||
{
|
||||
"file_path" : "data.asc.src",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "text used to build data.asc"
|
||||
},
|
||||
{
|
||||
"file_path" : "data.scrnshot.src",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "text used to build data.scrnshot"
|
||||
},
|
||||
{
|
||||
"file_path" : "data.src",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "text used to build data"
|
||||
},
|
||||
{
|
||||
"file_path" : "strings.asc.loc.txt",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "string locations from data.asc.src"
|
||||
},
|
||||
{
|
||||
"file_path" : "strings.loc.txt",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "string locations"
|
||||
},
|
||||
{
|
||||
"file_path" : "strings.scrnshot.loc.txt",
|
||||
"inventory_order" : 150,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "text",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "screenshot locations"
|
||||
},
|
||||
{
|
||||
"file_path" : "makedata.sh",
|
||||
"inventory_order" : 200,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "shellscript",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "script to generate V.c"
|
||||
},
|
||||
{
|
||||
"file_path" : "V.c",
|
||||
"inventory_order" : 1000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "include file for some tools"
|
||||
},
|
||||
{
|
||||
"file_path" : "2024_ferguson1.tar.bz2",
|
||||
"inventory_order" : 1415926535,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "tbz2",
|
||||
"display_via_github" : false,
|
||||
"entry_text" : "download entry tarball"
|
||||
},
|
||||
{
|
||||
"file_path" : ".entry.json",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "json",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "entry summary and manifest in JSON"
|
||||
},
|
||||
{
|
||||
"file_path" : ".gitignore",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "gitignore",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "list of files that should not be committed under git"
|
||||
},
|
||||
{
|
||||
"file_path" : ".path",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "path",
|
||||
"display_via_github" : false,
|
||||
"entry_text" : "directory path from top level directory"
|
||||
},
|
||||
{
|
||||
"file_path" : "README.md",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "markdown",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "markdown source for this web page"
|
||||
},
|
||||
{
|
||||
"file_path" : "deobfuscation.md",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "markdown",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "markdown source for deobfuscation.html"
|
||||
},
|
||||
{
|
||||
"file_path" : "obfuscation.md",
|
||||
"inventory_order" : 4000000000,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "markdown",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "markdown source for obfuscation.html"
|
||||
},
|
||||
{
|
||||
"file_path" : "index.html",
|
||||
"inventory_order" : 4294967295,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "html",
|
||||
"display_via_github" : false,
|
||||
"entry_text" : "this web page"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
addpadding
|
||||
bytecheck
|
||||
bytecount
|
||||
byteread
|
||||
bytetest
|
||||
data
|
||||
data.asc
|
||||
data.scrnshot
|
||||
lencount
|
||||
mbcheck
|
||||
printer
|
||||
prog.alt.asc
|
||||
prog.alt.scrnshot
|
||||
prog.asc
|
||||
prog.scrnshot
|
||||
@@ -0,0 +1 @@
|
||||
2024/ferguson1
|
||||
Binary file not shown.
@@ -0,0 +1,387 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2024/ferguson1
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
|
||||
SHELL= bash
|
||||
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
|
||||
include ../../var.mk
|
||||
|
||||
|
||||
#####################
|
||||
# C compiler settings
|
||||
#####################
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
# Example: CSILENCE= -Wno-poison-system-directories
|
||||
#
|
||||
CSILENCE= -Wno-strict-prototypes -Wno-implicit-fallthrough -Wno-misleading-indentation
|
||||
|
||||
# Attempt to silence unknown warning options
|
||||
#
|
||||
CUNKNOWN= -Wno-unknown-warning-option
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
# NOTE: The addition of -pedantic to CWARN is a challenge that
|
||||
# You may wish to avoid if it proves too problematic.
|
||||
# There is NO penalty for removing -pedantic from CWARN.
|
||||
#
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE} ${CUNKNOWN}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
CSTD= -std=gnu17
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Example for 32-bitness: ARCH= -m32
|
||||
# Example for 64-bitness: ARCH= -m64
|
||||
#
|
||||
# NOTE: Normally one should NOT specify a specific architecture.
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
# The DATA define not here is primarily for portability with emojis so it's
|
||||
# defined in the respective rules. It amounts to either "data" or "data.asc" (or
|
||||
# "data.scrnshot") and is a data file to open.
|
||||
#
|
||||
CDEFINE= -DBLOCKSIZE=1663
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
# Example: CINCLUDE= -include stdio.h
|
||||
#
|
||||
CINCLUDE=
|
||||
|
||||
# Other flags to pass to the C compiler
|
||||
#
|
||||
# Example: COTHER= -fno-math-errno
|
||||
#
|
||||
COTHER=
|
||||
|
||||
# Optimization
|
||||
#
|
||||
# NOTE: Feel free to change the level of compiler optimization.
|
||||
# The "-O3" is just a friendly default you might wish to try.
|
||||
#
|
||||
# Example: OPT= -O0 -g
|
||||
#
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${COTHER} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
# Example: LDFLAGS= -lncurses -lm
|
||||
#
|
||||
LDFLAGS=
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
# NOTE: The IOCCC Judges recommend you leave CC as just "cc"
|
||||
# and NOT set it to clang, or gcc, or something else
|
||||
# unless you have a STRONG reason to do so.
|
||||
#
|
||||
# Setting CC to something other than "cc" makes your
|
||||
# code less portable to those who do not have your
|
||||
# particular C compiler. **hint**
|
||||
#
|
||||
# If you want to test your code with a particular C compiler,
|
||||
# use the make command line. For example:
|
||||
#
|
||||
# make all CC=clang
|
||||
# make all CC=gcc
|
||||
#
|
||||
CC= cc
|
||||
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
|
||||
#
|
||||
# NOTE: This code is only invoked when CC is "clang"
|
||||
# such as when you use the make command line:
|
||||
#
|
||||
# make all CC=clang
|
||||
#
|
||||
CSILENCE+= -Wno-missing-prototypes -Wno-poison-system-directories -Wno-switch-default \
|
||||
-Wno-format-nonliteral -Wno-implicit-fallthrough \
|
||||
-Wno-misleading-indentation -Wno-missing-variable-declarations \
|
||||
-Wno-shorten-64-to-32 -Wno-unreachable-code -Wno-unsafe-buffer-usage
|
||||
#
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
endif
|
||||
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq "$(findstring $(GCC),${CC})" "$(GCC)"
|
||||
#
|
||||
# NOTE: This code is only invoked when CC is "gcc"
|
||||
# such as when you use the make command line:
|
||||
#
|
||||
# make all CC=gcc
|
||||
#
|
||||
CSILENCE+=
|
||||
#
|
||||
CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
|
||||
###########################################
|
||||
# Special Makefile variables for this entry
|
||||
###########################################
|
||||
|
||||
ENTRY= prog
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
TARGET= ${PROG} ${PROG}.asc ${PROG}.scrnshot
|
||||
|
||||
# .alt is as above more events
|
||||
#
|
||||
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt.asc.o ${PROG}.alt.scrnshot.o
|
||||
ALT_TARGET= ${PROG}.alt ${PROG}.alt.asc ${PROG}.alt.scrnshot
|
||||
|
||||
# list any data files supplied with the submission
|
||||
#
|
||||
# Don't include data, data.asc or data.scrnshot.
|
||||
# The data rule (although it's better to use makedata the data rule might work -
|
||||
# or it might not) is needed.
|
||||
#
|
||||
# The build of the programs use make padding however.
|
||||
#
|
||||
# I discuss the data files in obfuscation.md in more detail and I also mention
|
||||
# them in remarks.md (to do with troubleshooting and notes to the judges).
|
||||
#
|
||||
# As I noted in the remarks.md you should always make sure to rebuild them if
|
||||
# there is some kind of error: basically a pre-process for the code. No issues
|
||||
# have occurred since I added the build of the data files in the build of the
|
||||
# program but it is theoretically possible.
|
||||
#
|
||||
# It isn't always necessary to build the data files but when developing it was
|
||||
# VERY necessary hence all the protections in place (and the discussion in the
|
||||
# remarks.md). In any event the data files are built at build time so they
|
||||
# should not be in this variable.
|
||||
#
|
||||
# Observe too that the rules to compile programs do NOT depend on the data rule
|
||||
# and also do not depend on DATA (most anyway if not all). This is to help
|
||||
# prevent the programs being compiled every time the data files are updated.
|
||||
#
|
||||
DATA= data.src data.asc.src data.scrnshot.src
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.PHONY: all alt data everything clean clobber test
|
||||
|
||||
# how to compile
|
||||
#
|
||||
${PROG}: ${PROG}.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.c -o $@ ${LDFLAGS}
|
||||
|
||||
# test rule to make sure that no string in the data files are >= the blocksize
|
||||
# and the ASCII only data file does not have multibyte characters (or at least
|
||||
# 2, 3 or 4 bytes - unsure if more bytes in a single character is possible).
|
||||
#
|
||||
# The compilation rules use this to make sure there are no problems and it will
|
||||
# exit non-zero if there is any issue thus preventing the build of the specific
|
||||
# program.
|
||||
#
|
||||
test: lencount mbcheck
|
||||
@./lencount -t -i data.src
|
||||
@./lencount -t -i data.asc.src
|
||||
@./lencount -t -i data.scrnshot.src
|
||||
@./mbcheck
|
||||
|
||||
# ASCII only version of submission code, hence why the DATA macro is defined
|
||||
# here, not in CDEFINE.
|
||||
#
|
||||
${PROG}.asc: ${PROG}.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.asc"' ${PROG}.c -o $@ ${LDFLAGS}
|
||||
|
||||
# screenshot friendly version
|
||||
#
|
||||
${PROG}.scrnshot: ${PROG}.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool creates the data files (emoji and ASCII only versions).
|
||||
#
|
||||
# The warnings disabled are unfortunate. One is actually an extra sanity check
|
||||
# in case the exit(1); call was removed by mistake.
|
||||
#
|
||||
addpadding: addpadding.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break -Wno-sign-conversion addpadding.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool is the first step in helping some of the other tools work, as a
|
||||
# pre-processor. This tool is used in the makedata.sh script which is also a
|
||||
# pre-processor and must happen if the data source files are updated (which
|
||||
# should really only be done by me, the author, as I'm the only one who knows
|
||||
# precisely how it works and how perilous it can be to edit).
|
||||
#
|
||||
bytecount: bytecount.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break bytecount.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool helped me verify the locations of strings were correct (locations
|
||||
# are based on the blocksize). The bytecount also helped.
|
||||
#
|
||||
bytetest: bytetest.c
|
||||
${CC} ${CFLAGS} bytetest.c -o $@ ${LDFLAGS}
|
||||
|
||||
# similar to bytecount but it doesn't print out the location and it also parses
|
||||
# the file without caring about the NUL bytes (see if you can figure that out)
|
||||
#
|
||||
byteread: byteread.c
|
||||
${CC} ${CFLAGS} byteread.c -o $@ ${LDFLAGS}
|
||||
|
||||
# this tool was helpful to help identify if any emojis in the ASCII only version
|
||||
# slipped through (however, mbcheck is a better one: this tool is still
|
||||
# useful however). Probably only the judges will find this interesting just like
|
||||
# most of the tools I have provided.
|
||||
#
|
||||
bytecheck: bytecheck.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break bytecheck.c -o $@ ${LDFLAGS}
|
||||
|
||||
# by default this checks for multibyte characters (well 2, 3, 4) in the ASCII
|
||||
# data source file, reporting if any are found. If any are found it will report
|
||||
# which string so it can be fixed.
|
||||
#
|
||||
mbcheck: mbcheck.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break mbcheck.c -o $@ ${LDFLAGS}
|
||||
|
||||
# prints the strings in the data file for visual inspection. This could be
|
||||
# useful to check if your system supports all the emojis, although obviously
|
||||
# you'll need some sort of scrollback (or use less, perhaps with -r/-R - or
|
||||
# possibly redirect to a file if that is equivalent but if it is you could just
|
||||
# look at the strings.*loc.txt files).
|
||||
#
|
||||
printer: printer.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break printer.c -o $@ ${LDFLAGS}
|
||||
|
||||
# counts number of strings in data file and returns the longest one. Used in
|
||||
# calculating the blocksize (originally). It also warns about strings that are
|
||||
# >= the BLOCKSIZE in length. >= because we need the NUL byte too! With -t it
|
||||
# exits 666 if the blocksize is breached by a string.
|
||||
#
|
||||
lencount: lencount.c
|
||||
${CC} ${CFLAGS} -Wno-unreachable-code-break lencount.c -o $@ ${LDFLAGS}
|
||||
|
||||
|
||||
# IMPORTANT NOTES FOR THE JUDGES.
|
||||
#
|
||||
# The makedata.sh script will generate files that are needed by some of the
|
||||
# extra tools that I had to write and those tools should in general not be
|
||||
# needed by most. I include them to be complete and so you can see my very
|
||||
# thorough and careful design.
|
||||
#
|
||||
# The addpadding.c is necessary but it does not depend on makedata.sh and in
|
||||
# fact makedata.sh uses it.
|
||||
#
|
||||
# The addpadding tool ALWAYS updates all three data files, assuming the source
|
||||
# files exist of course; if they don't then obviously there is an error but as I
|
||||
# provide them this should not happen unless the Devil has visited you in the
|
||||
# night (in which case you might want to be worried, very worried, that
|
||||
# something might happen! :-) - maybe declare it a winner to satisfy the Devil?
|
||||
# :-) Okay joking aside you get the idea: this should not happen as the source
|
||||
# files and this tool are included.
|
||||
#
|
||||
# When in doubt, make sure the right data file is used (the different compiled
|
||||
# binaries based on the DATA macro) and that it was created by addpadding.c! And
|
||||
# do make sure you use the right version of addpadding.c - this submission does
|
||||
# NOT encrypt the data and the other one does! In fact there is an explicit
|
||||
# comment in addpadding.c about this.
|
||||
#
|
||||
padding: addpadding test
|
||||
@echo "Creating data file..."
|
||||
./addpadding
|
||||
@echo "Done."
|
||||
|
||||
# see remarks.md for more details. This script is mostly useful for the some of
|
||||
# the other tools but it can be used for prog.c and prog.alt.c indirectly as it
|
||||
# also does build the data files from the source files.
|
||||
#
|
||||
# An example use of when I personally use this rule: when I actually make an
|
||||
# edit to the data source files. As you will probably have noticed the printer.c
|
||||
# and bytetest.c tools depend on V.c and makedata.sh creates it so I have those
|
||||
# tools use that script too.
|
||||
#
|
||||
makedata: makedata.sh
|
||||
./makedata.sh
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# Devil's Cut: extra events that couldn't fit in the prog.c (alas!)
|
||||
#
|
||||
# As noted the DATA macro is for portability.
|
||||
#
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
# ASCII only version of alt code (Devil's Cut above). This is why indeed the
|
||||
# DATA variable is not in the CDEFINE - the .asc versions use the data.asc file.
|
||||
#
|
||||
${PROG}.alt.asc: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.asc"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
# screenshot friendly version of alt code
|
||||
#
|
||||
${PROG}.alt.scrnshot: ${PROG}.alt.c
|
||||
${MAKE} padding
|
||||
${CC} ${CFLAGS} -DDATA='"data.scrnshot"' ${PROG}.alt.c -o $@ ${LDFLAGS}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
@${TRUE}
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -rf *.dSYM
|
||||
${RM} -rf ${TARGET} addpadding bytetest byteread bytecount printer lencount bytecheck mbcheck data data.asc data.scrnshot
|
||||
|
||||
|
||||
######################################
|
||||
# optional include of 1337 hacker rulz
|
||||
######################################
|
||||
|
||||
-include 1337.mk ../1337.mk ../../1337.mk
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,172 @@
|
||||
V(1)
|
||||
V(2)
|
||||
V(3)
|
||||
V(4)
|
||||
V(5)
|
||||
V(6)
|
||||
V(7)
|
||||
V(8)
|
||||
V(9)
|
||||
V(10)
|
||||
V(11)
|
||||
V(12)
|
||||
V(13)
|
||||
V(14)
|
||||
V(15)
|
||||
V(16)
|
||||
V(17)
|
||||
V(18)
|
||||
V(19)
|
||||
V(20)
|
||||
V(21)
|
||||
V(22)
|
||||
V(23)
|
||||
V(24)
|
||||
V(25)
|
||||
V(26)
|
||||
V(27)
|
||||
V(28)
|
||||
V(29)
|
||||
V(30)
|
||||
V(31)
|
||||
V(32)
|
||||
V(33)
|
||||
V(34)
|
||||
V(35)
|
||||
V(36)
|
||||
V(37)
|
||||
V(38)
|
||||
V(39)
|
||||
V(40)
|
||||
V(41)
|
||||
V(42)
|
||||
V(43)
|
||||
V(44)
|
||||
V(45)
|
||||
V(46)
|
||||
V(47)
|
||||
V(48)
|
||||
V(49)
|
||||
V(50)
|
||||
V(51)
|
||||
V(52)
|
||||
V(53)
|
||||
V(54)
|
||||
V(55)
|
||||
V(56)
|
||||
V(57)
|
||||
V(58)
|
||||
V(59)
|
||||
V(60)
|
||||
V(61)
|
||||
V(62)
|
||||
V(63)
|
||||
V(64)
|
||||
V(65)
|
||||
V(66)
|
||||
V(67)
|
||||
V(68)
|
||||
V(69)
|
||||
V(70)
|
||||
V(71)
|
||||
V(72)
|
||||
V(73)
|
||||
V(74)
|
||||
V(75)
|
||||
V(76)
|
||||
V(77)
|
||||
V(78)
|
||||
V(79)
|
||||
V(80)
|
||||
V(81)
|
||||
V(82)
|
||||
V(83)
|
||||
V(84)
|
||||
V(85)
|
||||
V(86)
|
||||
V(87)
|
||||
V(88)
|
||||
V(89)
|
||||
V(90)
|
||||
V(91)
|
||||
V(92)
|
||||
V(93)
|
||||
V(94)
|
||||
V(95)
|
||||
V(96)
|
||||
V(97)
|
||||
V(98)
|
||||
V(99)
|
||||
V(100)
|
||||
V(101)
|
||||
V(102)
|
||||
V(103)
|
||||
V(104)
|
||||
V(105)
|
||||
V(106)
|
||||
V(107)
|
||||
V(108)
|
||||
V(109)
|
||||
V(110)
|
||||
V(111)
|
||||
V(112)
|
||||
V(113)
|
||||
V(114)
|
||||
V(115)
|
||||
V(116)
|
||||
V(117)
|
||||
V(118)
|
||||
V(119)
|
||||
V(120)
|
||||
V(121)
|
||||
V(122)
|
||||
V(123)
|
||||
V(124)
|
||||
V(125)
|
||||
V(126)
|
||||
V(127)
|
||||
V(128)
|
||||
V(129)
|
||||
V(130)
|
||||
V(131)
|
||||
V(132)
|
||||
V(133)
|
||||
V(134)
|
||||
V(135)
|
||||
V(136)
|
||||
V(137)
|
||||
V(138)
|
||||
V(139)
|
||||
V(140)
|
||||
V(141)
|
||||
V(142)
|
||||
V(143)
|
||||
V(144)
|
||||
V(145)
|
||||
V(146)
|
||||
V(147)
|
||||
V(148)
|
||||
V(149)
|
||||
V(150)
|
||||
V(151)
|
||||
V(152)
|
||||
V(153)
|
||||
V(154)
|
||||
V(155)
|
||||
V(156)
|
||||
V(157)
|
||||
V(158)
|
||||
V(159)
|
||||
V(160)
|
||||
V(161)
|
||||
V(162)
|
||||
V(163)
|
||||
V(164)
|
||||
V(165)
|
||||
V(166)
|
||||
V(167)
|
||||
V(168)
|
||||
V(169)
|
||||
V(170)
|
||||
V(171)
|
||||
V(172)
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* addpadding.c - add padding for each string in the data file.
|
||||
*
|
||||
* This DOES NOT ENCRYPT the data! That is the other submission. If this were to
|
||||
* encrypt then the tools and game would print out rubbish.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
static char padding[] = "ha_ha(){hell:goto hell;}main(){goto hell;hell:goto hell;ha_ha();main();goto hell;}";
|
||||
static char comment1[] = "/*useless code below, goto end of file*/";
|
||||
static char comment2[] = "/*useless code above, goto start of file*/";
|
||||
static FILE *in, *out, *prog;
|
||||
static char *buf, *p;
|
||||
static size_t len, len2, count, i, j, padlen;
|
||||
static char *data_src = "data.src";
|
||||
static char *data = "data";
|
||||
static char *data_asc_src = "data.asc.src";
|
||||
static char *data_asc = "data.asc";
|
||||
static char *data_scrnshot_src = "data.scrnshot.src";
|
||||
static char *data_scrnshot = "data.scrnshot";
|
||||
static char *prog_c_filename = "prog.c";
|
||||
static char *prog_c;
|
||||
static int l, k;
|
||||
|
||||
void make_data(char const *dst, char const *src)
|
||||
{
|
||||
if (in)
|
||||
{
|
||||
fclose(in);
|
||||
in = NULL;
|
||||
}
|
||||
|
||||
if (out)
|
||||
{
|
||||
fclose(out);
|
||||
out = NULL;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
in = fopen(src, "r");
|
||||
if (in == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: couldn't open data source file: %s\n", src, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
out = fopen(dst, "w");
|
||||
if (out == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: couldn't open output data file: %s\n", dst, strerror(errno));
|
||||
fclose(in);
|
||||
in = NULL;
|
||||
fclose(prog);
|
||||
prog = NULL;
|
||||
|
||||
free(prog_c);
|
||||
prog_c = NULL;
|
||||
exit(1);
|
||||
}
|
||||
l = fprintf(out, "%s",comment1);
|
||||
for (i = l; i < BLOCKSIZE; )
|
||||
{
|
||||
for (j = 0; j < padlen; ++j)
|
||||
if (j + i + 1 < BLOCKSIZE + 1)
|
||||
fputc(padding[j], out);
|
||||
i += j;
|
||||
}
|
||||
|
||||
while (getdelim(&buf, &len, '\0', in) != -1)
|
||||
{
|
||||
if (*buf == '%')
|
||||
fprintf(out, "%s", buf);
|
||||
else if (*buf == '\a')
|
||||
fprintf(out, "\b%s", buf+1);
|
||||
else for (p = buf; *p; ++p)
|
||||
fputc(*p, out);
|
||||
fputc('\0', out);
|
||||
for (i = strlen(buf) + 1; i < BLOCKSIZE; )
|
||||
{
|
||||
for (j = 0; j < padlen; ++j)
|
||||
if (j + i < BLOCKSIZE)
|
||||
fputc(padding[j], out);
|
||||
i += j;
|
||||
}
|
||||
}
|
||||
fprintf(out, "\n%s%s\n", comment2, comment1);
|
||||
|
||||
for (count = 0, p = prog_c; *p; ++p)
|
||||
{
|
||||
if (*p == '\n')
|
||||
{
|
||||
if (count<15)
|
||||
fputc('\n', out);
|
||||
else fprintf(out, "\n%s%s%s\n", comment1, padding, comment2);
|
||||
++count;
|
||||
continue;
|
||||
}
|
||||
else fputc(*p, out);
|
||||
}
|
||||
fprintf(out, "%s",comment2);
|
||||
fclose(in);
|
||||
in = NULL;
|
||||
fclose(out);
|
||||
out = NULL;
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
while ((k = getopt(argc, argv, "i:I:o:O:p:dt")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
data_src = optarg;
|
||||
break;
|
||||
case 'I':
|
||||
data_asc_src = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
data = optarg;
|
||||
break;
|
||||
case 'O':
|
||||
data_asc = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
prog_c_filename = optarg;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggers an annoying warning but it's a sanity check */
|
||||
}
|
||||
}
|
||||
|
||||
padlen = strlen(padding);
|
||||
|
||||
errno = 0;
|
||||
prog = fopen(prog_c_filename, "r");
|
||||
if (prog == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: couldn't open prog.c code file: %s\n", prog_c_filename, strerror(errno));
|
||||
fclose(in);
|
||||
in = NULL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
if (getdelim(&prog_c, &len2, EOF, prog) == -1)
|
||||
{
|
||||
fprintf(stderr, "couldn't read prog.c\n");
|
||||
fclose(in);
|
||||
in = NULL;
|
||||
fclose(prog);
|
||||
prog = NULL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
make_data(data, data_src);
|
||||
make_data(data_asc, data_asc_src);
|
||||
make_data(data_scrnshot, data_scrnshot_src);
|
||||
|
||||
fclose(prog);
|
||||
prog = NULL;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* bytecheck.c - writes the location of each string in a single char * but
|
||||
* ignores multibyte characters for a diff to make sure the locations are the
|
||||
* same in both versions of the data file. This is much less important with
|
||||
* mbcheck.c as that tool almost obsoletes it if it does not entirely.
|
||||
*
|
||||
* This version uses the source data file, data.src by default, and it reads one
|
||||
* 'string' at a time; it does not read in the whole file at once. With the -i
|
||||
* option it allows for another file. Redirecting to two different files allows
|
||||
* for comparing them, though there will be some differences based on emojis in
|
||||
* ASCII art (for one example) and differences in strings (for another).
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
size_t len = 0;
|
||||
char *buf = NULL;
|
||||
char *filename = "data.src";
|
||||
int k;
|
||||
int byte;
|
||||
size_t i = 0;
|
||||
|
||||
while ((k = getopt(argc, argv, "i:")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
filename = optarg;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggered an annoying warning but it's an extra sanity check */
|
||||
}
|
||||
}
|
||||
errno = 0;
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file: %s: %s\n", filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* i now starts out at 1 due to the way the padded file is
|
||||
*/
|
||||
i = 1;
|
||||
while (getdelim(&buf, &len, '\0', fp) != -1)
|
||||
{
|
||||
|
||||
printf("<%zu>\n", i);
|
||||
|
||||
for (k = 0; k[buf]; ++k)
|
||||
{
|
||||
byte = k[buf];
|
||||
if ((byte & 0xE0) == 0xC0)
|
||||
++k;
|
||||
else if ((byte & 0xF0) == 0xE0)
|
||||
k+= 2;
|
||||
else if ((byte & 0xF8) == 0xF0)
|
||||
k += 3;
|
||||
else putchar(byte);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* bytecount.c - writes the location of each string in a single char *.
|
||||
*
|
||||
* This version uses the source data file, data.src, and it reads one
|
||||
* 'string' at a time; it does not read in the whole file at once.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
size_t len = 0;
|
||||
char *buf = NULL;
|
||||
char *filename = "data.src";
|
||||
int k;
|
||||
size_t i = 0;
|
||||
|
||||
while ((k = getopt(argc, argv, "i:")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
filename = optarg;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggered an annoying warning but it's an extra sanity check */
|
||||
}
|
||||
}
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* i now starts out at 1 due to the way the padded file is
|
||||
*/
|
||||
i = 1;
|
||||
while (getdelim(&buf, &len, '\0', fp) != -1)
|
||||
{
|
||||
printf("<%zu>\n%s\n", i, *buf=='\a'?buf+1:buf);
|
||||
++i;
|
||||
}
|
||||
|
||||
/*
|
||||
* the next test was necessary earlier on but is not needed now. I keep it
|
||||
* here to document my procedure.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* clear out buf first
|
||||
*/
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
/*
|
||||
* reset EOF
|
||||
*/
|
||||
rewind(fp);
|
||||
|
||||
/*
|
||||
* now we have to verify that string 2 is what we see from the output (34).
|
||||
*
|
||||
* Obviously (if you look at data.src) the file has changed some since this byte
|
||||
* check.
|
||||
*/
|
||||
if (getdelim(&buf, &len, EOF, fp) != -1)
|
||||
{
|
||||
/*
|
||||
* we want to print the string that starts out at 34:
|
||||
*/
|
||||
printf("\n34: %s\n", buf+34);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
#endif
|
||||
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* very similar to bytecount.c but it doesn't print out the location of each
|
||||
* byte AND it also parses the file WITHOUT caring about the NUL bytes (how does
|
||||
* that work?).
|
||||
*
|
||||
* Note that this one does not have an option to specify which file is to be
|
||||
* read and it shouldn't need one at the late stage (at the time of writing
|
||||
* there was only one file - then I added the ASCII only one and then later
|
||||
* changed out the data.src to be data.scrnshot.src and made data.src wider in
|
||||
* text).
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int main(void)
|
||||
{
|
||||
FILE *fp = fopen("data.src", "r");
|
||||
char *p = NULL;
|
||||
size_t len = 0;
|
||||
char *buf = NULL;
|
||||
size_t i = 0, j = 0, k = 0;
|
||||
|
||||
/*
|
||||
* the question I had to determine the answer to is if getdelim() will stop
|
||||
* at the NUL byte. I feared it would but my fear was ungrounded. It
|
||||
* actually read up to the EOF!
|
||||
*/
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* as I already knew that getdelim(3) would read up to the EOF even with NUL
|
||||
* bytes in the file, I wanted to make sure the algorithm would work okay.
|
||||
* It's not exactly the algorithm I use as in the game I have to print only
|
||||
* a single string, not every string in the single char *. The algorithm
|
||||
* here is pretty simple to understand but it was important in testing.
|
||||
*
|
||||
* It simply prints out each string in the source data file but of course
|
||||
* the game itself prints the flat char *y which is the contents of the data
|
||||
* file itself.
|
||||
*/
|
||||
if (getdelim(&buf, &len, EOF, fp) != -1)
|
||||
{
|
||||
p = buf;
|
||||
while (i < len)
|
||||
{
|
||||
j = strlen(p);
|
||||
k = 0;
|
||||
while (k < j)
|
||||
{
|
||||
putchar(*(p+k));
|
||||
++k;
|
||||
}
|
||||
i += j + 1;
|
||||
p += j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* bytetest.c
|
||||
*
|
||||
* Write output in the game, to verify the bytes (locations) are okay.
|
||||
*
|
||||
* If the data file changes in certain ways these tests have to be run again and
|
||||
* the code of the game would potentially have to be updated too. This is why
|
||||
* the program exists.
|
||||
*
|
||||
* The bytecount.c is similar except it reads from the data source file and
|
||||
* reads a string at a time (NUL terminated).
|
||||
*
|
||||
* For this to work right one should run 'make makedata' first.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
char *p = NULL, *y;
|
||||
/*
|
||||
* Z calculates the block location.
|
||||
*/
|
||||
#define Z(x) (x)*1663
|
||||
#define V(x) { printf("<%zu>\n", (size_t)(x)); puts(&y[Z(x)]); }
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *fp = fopen("data", "r");
|
||||
size_t len = 0;
|
||||
|
||||
errno = 0;
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (getdelim(&y, &len, EOF, fp) != -1)
|
||||
{
|
||||
/*
|
||||
* now we have to test every single string to make sure it's valid.
|
||||
* The makedata.sh script generates V.c.
|
||||
*/
|
||||
#include "V.c"
|
||||
}
|
||||
|
||||
free(y);
|
||||
y = NULL;
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,621 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!-- START: two lines up starts content from: inc/top.default.html -->
|
||||
|
||||
<!-- END: this line ends content from: inc/top.default.html -->
|
||||
<!-- START: this line starts content from: inc/head.default.html -->
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="../../ioccc.css">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||||
<title>The International Obfuscated C Code Contest</title>
|
||||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||||
<meta name="description" content="deobfuscation.md for 2024/ferguson1">
|
||||
<meta name="keywords" content="IOCCC, 2024/ferguson1, deobfuscation.md">
|
||||
</head>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
|
||||
<!-- END: this line ends content from: inc/head.default.html -->
|
||||
|
||||
<!-- -->
|
||||
<!-- This web page was formed via the tool: bin/gen-other-html.sh -->
|
||||
<!-- The content of main section of this web page came from: 2024/ferguson1/deobfuscation.md -->
|
||||
<!-- -->
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/ferguson1/deobfuscation.md !!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/ferguson1/deobfuscation.md !!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/ferguson1/deobfuscation.md !!! -->
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
|
||||
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content from: inc/body.default.html -->
|
||||
|
||||
<body>
|
||||
|
||||
<!-- END: this line ends content from: inc/body.default.html -->
|
||||
<!-- START: this line starts content from: inc/topbar.default.html -->
|
||||
|
||||
<div class="theader">
|
||||
<nav class="topbar">
|
||||
<div class="container">
|
||||
<div class="logo">
|
||||
<a href="../../index.html" class="logo-link">
|
||||
IOCCC
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="topbar-items">
|
||||
<div class="item">
|
||||
<span class="item-header">
|
||||
Entries
|
||||
</span>
|
||||
|
||||
<div class="sub-item">
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../years.html" class="sub-item-link">
|
||||
Winning entries
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../authors.html" class="sub-item-link">
|
||||
Winning authors
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../location.html" class="sub-item-link">
|
||||
Location of authors
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../bugs.html" class="sub-item-link">
|
||||
Bugs and (mis)features
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
|
||||
Fixing entries
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html#fix_author" class="sub-item-link">
|
||||
Updating author info
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="item-header">
|
||||
Status
|
||||
</span>
|
||||
|
||||
<div class="sub-item">
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../news.html" class="sub-item-link">
|
||||
News
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../status.html" class="sub-item-link">
|
||||
Contest status
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../next/rules.html" class="sub-item-link">
|
||||
IOCCC rules
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../next/guidelines.html" class="sub-item-link">
|
||||
IOCCC guidelines
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../markdown.html" class="sub-item-link">
|
||||
Markdown guidelines
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../SECURITY.html" class="sub-item-link">
|
||||
Security policy
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="item-header">
|
||||
FAQ
|
||||
</span>
|
||||
|
||||
<div class="sub-item">
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html" class="sub-item-link">
|
||||
Frequently asked questions
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../quick-start.html#enter" class="sub-item-link">
|
||||
Enter the IOCCC
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html#compiling" class="sub-item-link">
|
||||
Compiling entries
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html#running_entries" class="sub-item-link">
|
||||
Running entries
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../faq.html#help" class="sub-item-link">
|
||||
How to help
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="item-header">
|
||||
About
|
||||
</span>
|
||||
|
||||
<div class="sub-item">
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../index.html" class="sub-item-link">
|
||||
Home page
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../social.html" class="sub-item-link">
|
||||
IOCCC social media
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../about.html" class="sub-item-link">
|
||||
About the IOCCC
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../judges.html" class="sub-item-link">
|
||||
The judges
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../thanks-for-help.html" class="sub-item-link">
|
||||
Thanks for the help
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="outfit-font">
|
||||
<a href="../../contact.html" class="sub-item-link">
|
||||
Contact us
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="header-mobile-menu">
|
||||
<noscript>
|
||||
<a href="../../nojs-menu.html" class="topbar-js-label">
|
||||
Please Enable JavaScript
|
||||
</a>
|
||||
</noscript>
|
||||
|
||||
<button id="header-open-menu-button" class="topbar-mobile-menu">
|
||||
<img
|
||||
src="../../png/hamburger-icon-open.png"
|
||||
alt="hamburger style menu icon - open state"
|
||||
width=48
|
||||
height=48>
|
||||
</button>
|
||||
|
||||
<button id="header-close-menu-button" class="hide-content">
|
||||
<img
|
||||
src="../../png/hamburger-icon-closed.png"
|
||||
alt="hamburger style menu icon - closed state"
|
||||
width=48
|
||||
height=48>
|
||||
</button>
|
||||
|
||||
<div id="mobile-menu-panel" class="hide-content">
|
||||
<div class="mobile-menu-container">
|
||||
|
||||
<div class="mobile-menu-wrapper">
|
||||
<div class="mobile-menu-item">
|
||||
Entries
|
||||
</div>
|
||||
<div class="mobile-submenu-wrapper">
|
||||
|
||||
<a class="mobile-submenu-item" href="../../years.html">
|
||||
Winning entries
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../authors.html">
|
||||
Winning authors
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../location.html">
|
||||
Location of authors
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../bugs.html">
|
||||
Bugs and (mis)features
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
|
||||
Fixing entries
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
|
||||
Updating author info
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
|
||||
Thanks for the help
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mobile-menu-wrapper">
|
||||
|
||||
<div class="mobile-menu-item">
|
||||
Status
|
||||
</div>
|
||||
<div class="mobile-submenu-wrapper">
|
||||
|
||||
<a class="mobile-submenu-item" href="../../news.html">
|
||||
News
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../status.html">
|
||||
Contest status
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../next/rules.html">
|
||||
IOCCC rules
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../next/guidelines.html">
|
||||
IOCCC guidelines
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../markdown.html">
|
||||
Markdown guidelines
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../SECURITY.html">
|
||||
Security policy
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mobile-menu-wrapper">
|
||||
<div class="mobile-menu-item">
|
||||
FAQ
|
||||
</div>
|
||||
<div class="mobile-submenu-wrapper">
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html">
|
||||
Frequently asked questions
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../quick-start.html#enter">
|
||||
Enter the IOCCC
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html#compiling">
|
||||
Compiling entries
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html#running_entries">
|
||||
Running entries
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../faq.html#help">
|
||||
How to help
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mobile-menu-wrapper">
|
||||
<div class="mobile-menu-item">
|
||||
About
|
||||
</div>
|
||||
<div class="mobile-submenu-wrapper">
|
||||
|
||||
<a class="mobile-submenu-item" href="../../index.html">
|
||||
Home page
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../social.html">
|
||||
IOCCC social media
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../about.html">
|
||||
About the IOCCC
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../judges.html">
|
||||
The judges
|
||||
</a>
|
||||
|
||||
<a class="mobile-submenu-item" href="../../contact.html">
|
||||
Contact us
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
|
||||
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
|
||||
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
|
||||
|
||||
headerOpenMenuButton.addEventListener("click", () => {
|
||||
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
|
||||
headerOpenMenuButton.classList.add("hide-content");
|
||||
|
||||
headerCloseMenuButton.classList.remove("hide-content");
|
||||
headerCloseMenuButton.classList.add("topbar-mobile-menu");
|
||||
|
||||
mobileMenuPanel.classList.remove("hide-content");
|
||||
mobileMenuPanel.classList.add("topbar-mobile-panel");
|
||||
});
|
||||
|
||||
headerCloseMenuButton.addEventListener("click", () => {
|
||||
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
|
||||
headerCloseMenuButton.classList.add("hide-content");
|
||||
|
||||
mobileMenuPanel.classList.add("hide-content");
|
||||
mobileMenuPanel.classList.remove("topbar-mobile-panel");
|
||||
|
||||
headerOpenMenuButton.classList.add("topbar-mobile-menu");
|
||||
headerOpenMenuButton.classList.remove("hide-content");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- END: this line ends content from: inc/topbar.default.html -->
|
||||
<!-- START: this line starts content from: inc/header.default.html -->
|
||||
|
||||
<div class="header">
|
||||
<a href="../../2011/zucker/index.html">
|
||||
<img src="../../png/ioccc.png"
|
||||
alt="IOCCC image by Matt Zucker"
|
||||
width=300
|
||||
height=110>
|
||||
</a>
|
||||
<h1>The International Obfuscated C Code Contest</h1>
|
||||
<h2>deobfuscation.html for 2024/ferguson1</h2>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/header.default.html -->
|
||||
<!-- START: this line starts content from: inc/navbar.up2index.html -->
|
||||
|
||||
<div class="navbar">
|
||||
<a class="Left" href="index.html">↑ jump to 2024/ferguson1/index.html ↑</a>
|
||||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2024%2Fferguson1%2Fdeobfuscation.html">✓</a>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/navbar.up2index.html -->
|
||||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||||
|
||||
<div class="content" id="content">
|
||||
|
||||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- BEFORE: 1st line of markdown file: 2024/ferguson1/deobfuscation.md -->
|
||||
<p>The following hints were used for myself but also I offer them for those who
|
||||
wish to more easily follow the code, though that might or might not help that
|
||||
much. If a variable or other kind of symbol is missing or is not what it says
|
||||
here that was by (in some cases) simply missing it or (in other cases) due to
|
||||
having changed things a fair amount; this submission took a lot of work and time
|
||||
to get everything in. One variable, <code>p</code>, is for the encrypted version only.</p>
|
||||
<p>The following variables are of primary concern (some temporary ones are not
|
||||
documented I think):</p>
|
||||
<ul>
|
||||
<li>O: how much you spend on oxen</li>
|
||||
<li>R: amount spent on food</li>
|
||||
<li>E: amount spent on ammo</li>
|
||||
<li>G: amount spent on clothing</li>
|
||||
<li>O: how much you spend on oxen</li>
|
||||
<li>N: amount spent on miscellaneous supplies</li>
|
||||
<li>T: how much money you have</li>
|
||||
<li>e: ate an ox</li>
|
||||
<li>b: hp (hit points, starts out at 666, allows for survival in conditions you
|
||||
can’t in the original) or stamina (kind of a combination - if you get injured
|
||||
and you see the doctor and can afford it you will not keep losing hp but you
|
||||
won’t gain any either).</li>
|
||||
<li>A: turn number for setting date (the first week, Monday 29 March 1847 is at
|
||||
16 so to print the second week day date month and year (though it does it March
|
||||
29 like the American way) you would do <code>V(A+16)</code>) (note that the date is not set
|
||||
in a variable but rather for printing the date)</li>
|
||||
<li>I: unused except to spell out OREGON TRAIL.</li>
|
||||
<li>L: amount spent on items at fort (used as a temporary money value for
|
||||
calculations at fort)</li>
|
||||
<li>q: event number</li>
|
||||
<li>f: flag for injury</li>
|
||||
<li>M: total distance travelled</li>
|
||||
<li>a: flag for illness</li>
|
||||
<li>z: flag for fort option</li>
|
||||
<li>K: the <code>FILE *</code> (data file)</li>
|
||||
<li>y: contents of data file</li>
|
||||
<li>p: used to print (one character at a time) the strings (encrypted version only)</li>
|
||||
<li>r: (unsigned) answer to certain questions</li>
|
||||
<li>d: son froze to death (and you ate him)</li>
|
||||
<li>J: file length read (fun fact: as part of obfuscation in multiple levels, <code>J != strlen(y)</code>!). It’s reused in the V function after being set to 0.</li>
|
||||
<li>l: non-zero when hunting.</li>
|
||||
<li>W: flag for clearing Blue Mountains.</li>
|
||||
<li>Q: got dysentery and went to doctor (I think only if you could afford the
|
||||
doctor but not sure)</li>
|
||||
<li>B: if non-zero, can’t afford the doctor, don’t try again (this prevents a
|
||||
flood of the message each turn).</li>
|
||||
<li>h: I believe this is if you were injured and could afford the doctor.</li>
|
||||
<li>c: hit blizzard.</li>
|
||||
<li>X: passed South Pass.</li>
|
||||
<li>i: been poisoned; you will be dead shortly (sorry - that’s what happens when
|
||||
you have a pact with the devil!).</li>
|
||||
<li>g: how many limbs you’ve had to cut off (surgeon’s cut edition)</li>
|
||||
<li>t: temporary array for purchasing at forts.</li>
|
||||
<li>u: temporary unsigned int to iterate through array <code>t</code> (and maybe other
|
||||
uses, not sure now).</li>
|
||||
<li>v: non-zero means ran out of oxen so as to not flood user every turn with
|
||||
certain messages. But if you buy more that could in theory happen again. Note
|
||||
that some messages might be printed instead of the you have run out of oxen
|
||||
message, if they’re the ones causing it, though I’m not going to say this is in
|
||||
every case as there are a lot of ways for this to happen.</li>
|
||||
<li>any other variable I haven’t the foggiest, even if it’s not related to fog (of
|
||||
which there is an event where you encounter fog) - sorry. An example here is
|
||||
<code>m</code>.</li>
|
||||
</ul>
|
||||
<p>When an amount spent (if it happens, not necessarily going to for every
|
||||
variable) spent ends up being < 0 (it’s not allowed to go that low when
|
||||
purchasing) it means that there is an insufficient amount (thus a variable
|
||||
reuse).</p>
|
||||
<p>The array:</p>
|
||||
<pre><code> long *o[]={ &O, &R, &E, &G, &N } /* animals, food, ammo, clothing, misc. supplies</code></pre>
|
||||
<p>is used in at least one loop to not have to do checks individually. The
|
||||
variables, btw, are not how many as such (well in some cases it is, although
|
||||
with the number of animals it’s a ‘taken at liberty’ and based on my
|
||||
interpretation of the original 1978 BASIC game) but rather
|
||||
how much was spent on them. As for the ammo: $1 spent on ammo means a belt of 50.
|
||||
That means another variable has to exist (that would be the <code>I</code> one) and
|
||||
every time a purchase is made (at fort or initially) <code>I</code> is set to <code>E * 50</code>.</p>
|
||||
<p>The functions:</p>
|
||||
<ul>
|
||||
<li>main(): you know what this is: or…do you?</li>
|
||||
<li>k(): the function that determines if you shoot successfully.</li>
|
||||
<li>x: uses <code>rand()</code> to get a pRNG number in a range.</li>
|
||||
<li>V: the nasty function that decrypts (one character at a time) strings in the
|
||||
data file. Or doesn’t really decrypt it per se.</li>
|
||||
<li>Z: calculates address of a block in the file (used by function <code>V</code> and macro <code>S</code>).</li>
|
||||
</ul>
|
||||
<p>The macro:</p>
|
||||
<ul>
|
||||
<li>S: scanf macro.</li>
|
||||
<li>w: death macro which will ‘goto hell’.</li>
|
||||
</ul>
|
||||
<p>If you expect me to try and describe the labels I will direct you straight to
|
||||
line 22!
|
||||
<!-- AFTER: last line of markdown file: 2024/ferguson1/deobfuscation.md --></p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||||
<!-- START: this line starts content from: inc/footer.default.html -->
|
||||
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2025 by Landon Curt Noll. All Rights Reserved.
|
||||
|
||||
You are free to share and adapt this file under the terms of this license:
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
|
||||
For more information, see:
|
||||
|
||||
https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
-->
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div id="copyright"><h3>Copyright © 1984-2025 by Landon Curt Noll:
|
||||
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
|
||||
target="_blank"
|
||||
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
|
||||
<p>
|
||||
This work is <b>licensed by Landon Curt Noll</b> under
|
||||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
|
||||
target="_blank"
|
||||
rel="license noopener noreferrer"
|
||||
style="display:inline-block;">CC BY-SA 4.0</a></b>.
|
||||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||||
src="../../png/cc.png"
|
||||
alt="cc inside circle symbol">
|
||||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||||
src="../../png/by.png"
|
||||
alt="person inside circle symbol">
|
||||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||||
src="../../png/sa.png"
|
||||
alt="arrow looping back on itself inside circle symbol"><br>
|
||||
You should <b>carefully review</b> the
|
||||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
|
||||
target="_blank"
|
||||
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
|
||||
before using the licensed material.<br>
|
||||
You may wish to review the
|
||||
<b><a href="../../license.html"
|
||||
target="_blank"
|
||||
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
|
||||
of <b>CC BY-SA 4.0</b>.<br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="coda"><h3>Coda</h3>
|
||||
<p>
|
||||
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2024%2Fferguson1%2Fdeobfuscation.html" rel="nofollow">Nu HTML check this web page</a><br>
|
||||
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/footer.default.html -->
|
||||
<!-- START: this line starts content from: inc/bottom.default.html -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- END: this line ends content from: inc/bottom.default.html -->
|
||||
@@ -0,0 +1,100 @@
|
||||
The following hints were used for myself but also I offer them for those who
|
||||
wish to more easily follow the code, though that might or might not help that
|
||||
much. If a variable or other kind of symbol is missing or is not what it says
|
||||
here that was by (in some cases) simply missing it or (in other cases) due to
|
||||
having changed things a fair amount; this submission took a lot of work and time
|
||||
to get everything in. One variable, `p`, is for the encrypted version only.
|
||||
|
||||
The following variables are of primary concern (some temporary ones are not
|
||||
documented I think):
|
||||
|
||||
- O: how much you spend on oxen
|
||||
- R: amount spent on food
|
||||
- E: amount spent on ammo
|
||||
- G: amount spent on clothing
|
||||
- O: how much you spend on oxen
|
||||
- N: amount spent on miscellaneous supplies
|
||||
- T: how much money you have
|
||||
- e: ate an ox
|
||||
- b: hp (hit points, starts out at 666, allows for survival in conditions you
|
||||
can't in the original) or stamina (kind of a combination - if you get injured
|
||||
and you see the doctor and can afford it you will not keep losing hp but you
|
||||
won't gain any either).
|
||||
- A: turn number for setting date (the first week, Monday 29 March 1847 is at
|
||||
16 so to print the second week day date month and year (though it does it March
|
||||
29 like the American way) you would do `V(A+16)`) (note that the date is not set
|
||||
in a variable but rather for printing the date)
|
||||
- I: unused except to spell out OREGON TRAIL.
|
||||
- L: amount spent on items at fort (used as a temporary money value for
|
||||
calculations at fort)
|
||||
- q: event number
|
||||
- f: flag for injury
|
||||
- M: total distance travelled
|
||||
- a: flag for illness
|
||||
- z: flag for fort option
|
||||
- K: the `FILE *` (data file)
|
||||
- y: contents of data file
|
||||
- p: used to print (one character at a time) the strings (encrypted version only)
|
||||
- r: (unsigned) answer to certain questions
|
||||
- d: son froze to death (and you ate him)
|
||||
- J: file length read (fun fact: as part of obfuscation in multiple levels, `J
|
||||
!= strlen(y)`!). It's reused in the V function after being set to 0.
|
||||
- l: non-zero when hunting.
|
||||
- W: flag for clearing Blue Mountains.
|
||||
- Q: got dysentery and went to doctor (I think only if you could afford the
|
||||
doctor but not sure)
|
||||
- B: if non-zero, can't afford the doctor, don't try again (this prevents a
|
||||
flood of the message each turn).
|
||||
- h: I believe this is if you were injured and could afford the doctor.
|
||||
- c: hit blizzard.
|
||||
- X: passed South Pass.
|
||||
- i: been poisoned; you will be dead shortly (sorry - that's what happens when
|
||||
you have a pact with the devil!).
|
||||
- g: how many limbs you've had to cut off (surgeon's cut edition)
|
||||
- t: temporary array for purchasing at forts.
|
||||
- u: temporary unsigned int to iterate through array `t` (and maybe other
|
||||
uses, not sure now).
|
||||
- v: non-zero means ran out of oxen so as to not flood user every turn with
|
||||
certain messages. But if you buy more that could in theory happen again. Note
|
||||
that some messages might be printed instead of the you have run out of oxen
|
||||
message, if they're the ones causing it, though I'm not going to say this is in
|
||||
every case as there are a lot of ways for this to happen.
|
||||
- any other variable I haven't the foggiest, even if it's not related to fog (of
|
||||
which there is an event where you encounter fog) - sorry. An example here is
|
||||
`m`.
|
||||
|
||||
When an amount spent (if it happens, not necessarily going to for every
|
||||
variable) spent ends up being < 0 (it's not allowed to go that low when
|
||||
purchasing) it means that there is an insufficient amount (thus a variable
|
||||
reuse).
|
||||
|
||||
The array:
|
||||
|
||||
``` <!---c-->
|
||||
long *o[]={ &O, &R, &E, &G, &N } /* animals, food, ammo, clothing, misc. supplies
|
||||
```
|
||||
|
||||
is used in at least one loop to not have to do checks individually. The
|
||||
variables, btw, are not how many as such (well in some cases it is, although
|
||||
with the number of animals it's a 'taken at liberty' and based on my
|
||||
interpretation of the original 1978 BASIC game) but rather
|
||||
how much was spent on them. As for the ammo: $1 spent on ammo means a belt of 50.
|
||||
That means another variable has to exist (that would be the `I` one) and
|
||||
every time a purchase is made (at fort or initially) `I` is set to `E * 50`.
|
||||
|
||||
The functions:
|
||||
|
||||
- main(): you know what this is: or...do you?
|
||||
- k(): the function that determines if you shoot successfully.
|
||||
- x: uses `rand()` to get a pRNG number in a range.
|
||||
- V: the nasty function that decrypts (one character at a time) strings in the
|
||||
data file. Or doesn't really decrypt it per se.
|
||||
- Z: calculates address of a block in the file (used by function `V` and macro `S`).
|
||||
|
||||
The macro:
|
||||
|
||||
- S: scanf macro.
|
||||
- w: death macro which will 'goto hell'.
|
||||
|
||||
If you expect me to try and describe the labels I will direct you straight to
|
||||
line 22!
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 446 KiB |
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* lencount.c - finds longest length string.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
static int testmode;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *filename = "data.src";
|
||||
FILE *fp = NULL;
|
||||
char *buf = NULL, *p=0;
|
||||
size_t len = 0, strings = 0, longest = 0;
|
||||
int k, exitcode = 0;
|
||||
|
||||
while ((k = getopt(argc, argv, "i:t")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
filename = optarg;
|
||||
break;
|
||||
case 't':
|
||||
testmode = 1;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggered an annoying warning but it's an extra sanity check */
|
||||
}
|
||||
}
|
||||
errno = 0;
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file %s: %s\n", filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (getdelim(&buf, &len, '\0', fp) != -1)
|
||||
{
|
||||
++strings;
|
||||
if (strlen(buf) >= BLOCKSIZE)
|
||||
{
|
||||
if (testmode)
|
||||
exitcode = 666;
|
||||
else
|
||||
printf("WARNING: string %zu is >= BLOCKSIZE length: %zu >= %d\n", strings, strlen(buf), BLOCKSIZE);
|
||||
}
|
||||
if (strlen(buf) > longest)
|
||||
{
|
||||
longest = strlen(buf);
|
||||
if (p)free(p);
|
||||
p = strdup(buf);
|
||||
}
|
||||
}
|
||||
if (p)
|
||||
{
|
||||
if (!testmode)
|
||||
printf("out of a total of %zu strings, %zu is the longest string:\n%s\n\n", strings, longest, p);
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "error: no string found!\n");
|
||||
exit(666);
|
||||
}
|
||||
|
||||
if (testmode && exitcode != 0)
|
||||
{
|
||||
fprintf(stderr, "failed testmode: run '%s -i %s' (without -t) to see problematic strings!",
|
||||
argv[0], filename);
|
||||
exit(exitcode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
make clobber
|
||||
make addpadding
|
||||
make bytecount
|
||||
echo ./addpadding
|
||||
./addpadding
|
||||
./bytecount > strings.loc.txt
|
||||
./bytecount -i data.asc.src > strings.asc.loc.txt
|
||||
./bytecount -i data.scrnshot.src > strings.scrnshot.loc.txt
|
||||
grep '<' strings.loc.txt > bytes.txt
|
||||
while read byte ; do echo "V($(echo $byte|sed -e 's,<,,g' -e 's,>,,g'))"; done < bytes.txt > V.c
|
||||
make everything
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* mbcheck.c - writes the location of each string in a single char * but
|
||||
* ignores single byte characters to see ONLY emojis. By write location and see
|
||||
* where only emojis are it means warn about it, not print it out itself.
|
||||
*
|
||||
* This way I can check if the ASCII only data file has any emojis (or other
|
||||
* multibyte characters) by accident. This is why it reads from the ASCII only
|
||||
* data source file by default, but it can be used on data.src too with -i
|
||||
* data.src to see which strings have emojis.
|
||||
*
|
||||
* It reads one 'string' at a time; it does not read in the whole file at once.
|
||||
* option it allows for another file.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static unsigned loc = 0;
|
||||
static char const *filename = "data.asc.src";
|
||||
static uintmax_t unicode = 0;
|
||||
static uintmax_t codes = 0;
|
||||
static size_t i = 0;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
size_t len = 0;
|
||||
char *buf = NULL;
|
||||
int k;
|
||||
int byte;
|
||||
|
||||
while ((k = getopt(argc, argv, "i:l")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
filename = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
loc = 1;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggered an annoying warning but it's an extra sanity check */
|
||||
}
|
||||
}
|
||||
errno = 0;
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file %s: %s\n", filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* i now starts out at 1 due to the way the padded file is
|
||||
*/
|
||||
i = 1;
|
||||
while (getdelim(&buf, &len, '\0', fp) != -1)
|
||||
{
|
||||
for (codes = k = 0; k[buf]; ++k)
|
||||
{
|
||||
byte = k[buf];
|
||||
if ((byte & 0xF8) == 0xF0)
|
||||
{
|
||||
if (loc) printf("<%zu:%d>\n", i, k);
|
||||
k += 3;
|
||||
++unicode;
|
||||
++codes;
|
||||
}
|
||||
else if ((byte & 0xF0) == 0xE0)
|
||||
{
|
||||
if (loc) printf("<%zu:%d>\n", i, k);
|
||||
k+= 2;
|
||||
++unicode;
|
||||
++codes;
|
||||
}
|
||||
else if ((byte & 0xE0) == 0xC0)
|
||||
{
|
||||
if (loc) printf("<%zu:%d>\n", i, k);
|
||||
++k;
|
||||
++unicode;
|
||||
++codes;
|
||||
}
|
||||
}
|
||||
if (codes)
|
||||
fprintf(stderr, "%4ju unicode character%s found in string %zu in file %s\n", codes,
|
||||
codes==1?"":"s", i, filename);
|
||||
++i;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
printf("%ju unicode character%s found in %s\n", unicode, unicode==1?"":"s", filename);
|
||||
if (unicode > 0)
|
||||
exit(666);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* printer.c - prints out everything from data file for visual inspection
|
||||
*
|
||||
* This tool can be used to not only help identify if your system will work with
|
||||
* the emojis data file but also show what the strings are without having to
|
||||
* look at the source data file (this program decrypts the strings in a similar
|
||||
* way to the game itself, see below).
|
||||
*
|
||||
* Using the macro (identical except it uses puts() on some of the strings that
|
||||
* are unencrypted) from prog.c we will print out every string
|
||||
* at every location in the order it occurs.
|
||||
*
|
||||
* IMPORTANT NOTE: as some strings have a marker that indicates to not be
|
||||
* encrypted but the marker is not in the data file itself, the bytecount.c
|
||||
* might be better in that it uses the data source file. However for my own
|
||||
* purposes I have this tool too. This tool, to prevent display problems, checks
|
||||
* for specific known locations where it should not decrypt anything due to not
|
||||
* being encrypted (the '%' ones notwithstanding), and if it is that number it
|
||||
* will print it out with puts() instead (can't be printf() as it has %
|
||||
* conversions). A BEL byte also is unencrypted (if it's the first character of
|
||||
* the string it's skipped and printed without encrypting it).
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* macro similar to prog.c
|
||||
*/
|
||||
#define Z(x) (x)*BLOCKSIZE
|
||||
#define V(x) puts(&y[Z(x)]);
|
||||
static char *p;
|
||||
static char *y;
|
||||
static char *filename = "data";
|
||||
static size_t len;
|
||||
static int k;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
|
||||
while ((k = getopt(argc, argv, "i:")) != -1)
|
||||
{
|
||||
switch (k)
|
||||
{
|
||||
case 'i':
|
||||
filename = optarg;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
exit(1);
|
||||
break; /* this triggered an annoying warning but it's an extra sanity check */
|
||||
}
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
fp = fopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "couldn't open data file %s: %s\n", filename, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (getdelim(&y, &len, EOF, fp) != -1)
|
||||
{
|
||||
/*
|
||||
* now we have to test every single string to make sure it's valid.
|
||||
* The makedata.sh script generates V.c.
|
||||
*/
|
||||
#include "V.c"
|
||||
}
|
||||
|
||||
free(y);
|
||||
y = NULL;
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<time.h>
|
||||
#include<stdlib.h>
|
||||
#include<unistd.h>
|
||||
long x(long y,long z){ return rand()%(z-y+1)+y; }
|
||||
unsigned m,D,Q,v,l,Y,f,g,X,z,B,i,h,
|
||||
r,u,d,e; long
|
||||
O,R,E,G,O,N, T,R,A,I,L,
|
||||
*o[]={ &O,&R,&E,&G,&O,&N,&I} ,a,t[7],q,M, b=666,c,W;
|
||||
char *y; FILE*K; size_t J;
|
||||
#define j E=I/5;
|
||||
#define w(i) { V(i); V(4); goto hell; }
|
||||
long Z(long x){ return x *1663; }
|
||||
#define S(x,z) while(scanf(&y[Z(x)],&z)!=1)while(getchar()!='\n');
|
||||
void V(long x) { printf("%s",&y[Z(x)]); }
|
||||
long k(void) { ++ Y; return I>0?x(1,101)+ Y>53 +a?9:0+f?9:0:0; } int main(void){ srand(time(0));
|
||||
|
||||
K=fopen(DATA,"r"); if(!K||getdelim(&y,&J,EOF,K)<0)goto hell; goto s; aa:goto dd; u: goto M; ee:goto ff; jj:goto kk; N:for (X=
|
||||
|
||||
1; X < 6; ++X) { x:V(X+--(
|
||||
|
||||
int){ 6} ); if(z ){ S(3,
|
||||
|
||||
t[X]) if(t[X]<0 ||t[X]>
|
||||
|
||||
666){ V(14); goto x; goto
|
||||
heaven; l:goto C; JJ:goto W; qq:goto rr; } L=T; for(u
|
||||
|
||||
=0; u < 6; ++u)L-=t[u];
|
||||
|
||||
if(L<0){ V(46); memset(&t,0,
|
||||
|
||||
sizeof t); goto v; ZZ:goto II; } }
|
||||
|
||||
else{ S(3 ,*(o[X])) if(
|
||||
|
||||
*o[X]<0||*o[X] >666){ V(14);
|
||||
|
||||
goto x; } T=1666-O-R-E-G-0-N; if(T<0){ V(46); O=R=E=G=N=0; goto v; c: goto d; oo:goto pp; } } } if(z)goto A; B:I=E*5;
|
||||
|
||||
printf(&y[Z(12)],T); if(z) goto F; switch(1) { dd:goto cc; I:goto R; default: do { if(b<1||M<0||M>2169) break; goto i;
|
||||
|
||||
e:goto D; P: for (X=1; X<7; ++X) if (*o[X]<0) *o[X]=0;
|
||||
printf(&y[Z(11)],R,I,G,O,N,T,b,M); if(x(0,1))goto Q; R:if(R<14)V(37); if(z) { r: V(43); S(2,r)
|
||||
|
||||
switch (r) { H: goto G; case 1: goto T; i:if(O<1){ if(!v)V(v=15); O=0; } else v=0; goto e; case 2: goto X; F:
|
||||
|
||||
goto f; a:goto c; default: goto r; O:goto E; } } else{ y:V(42); S(2,r) switch(r) { M:V(1); v:memset(&t,0,sizeof t); goto
|
||||
|
||||
N; case 3: goto X; nn:goto oo; case 1 : z=1; M-=45; goto L; A:for(X=1; X < 7; ++X){ *o[X]+=t[X]; T-=X[t]; } goto B;
|
||||
|
||||
case 2: goto T; default: goto y; } } L:goto v; T:l=1; if (I<9)V(16); else { if (k()) { if (x(1,10) > 5) { V(52);
|
||||
|
||||
R += 23; if(!x(0,9))i=17; } else{ V(51); R+=18; } } else { V(53); } I-=9; j M-=45; } l=0; f: z=0;
|
||||
|
||||
X: if(R<1){ if(O>39){ V(e=x(0,1)?18:19); O -= 40; goto q; o: goto Y; ii:goto l; } w(24) } else goto K; Y: switch(q=x(0,24))
|
||||
|
||||
{ s: goto h;
|
||||
case 24:if(++g<4) V(73); else w(147) break;
|
||||
case 23:
|
||||
if (d) V(39); if (e) V(25); break; case 1: V(95); R+=5; break; S: if (I>1999) w(27) V(82); M-=9; N-=5; R-=20; goto Z;
|
||||
case 18:V(26); break; case 13: V(28); break;
|
||||
case 2: O-=40; V(71); break; mm:goto nn;
|
||||
|
||||
case 3: V(a=76); b-=70; goto jj; case 4:V(77); N-=7; M-=7; break; case 5:case
|
||||
|
||||
10: if(q<6) { V(78); if(k()) { V(81); R+=9; N+=3; } else { V(f=79); b-=80; T/=4; } I=0; j } else
|
||||
{ V(56); if (k()) { V(a=29); T+=70; break; cc:goto ee; } else { V(f=62); M-=50; b-=35; } } break;
|
||||
case 9: case 19:V(30); break; case 20:V(32); break; case 21: V(31); break; case 6: goto g; Z: break; case 16: case 22:V(49); break; case 17: V(72); break;
|
||||
case 7: V(83); M-=10; break; D: goto P; case 8: V(86); R-=30; G-=20; O-=40; V
|
||||
:switch(x(1,9)) { case 2: if(q>9){ switch(x(1,2)){ q:R+=40; goto o; case 1: switch (x(2,3)) { case 2: V(a=54); goto
|
||||
|
||||
m; b: w(48)
|
||||
case 3:goto J; } case 2: V(5); } goto E; ll:goto mm; J: V(a=54); } goto O; KK:goto JJ; m
|
||||
|
||||
:goto O; goto m; default: if(q>10) goto E; if(q>7) { if(N<5) w(99) V(13); N-=5; } break; } M-=17; break; C:goto k; K:R-=R
|
||||
|
||||
>23 ? 23 : R > 18 ? 18 : R > 13 ? 13 :
|
||||
R; goto Y; case 14: V(74); break; case 15: V(x(0,1)?69:68);
|
||||
break; d: goto I; case 11: goto V; kk:goto ll; case
|
||||
|
||||
12:V(94); M-=5; b-=19; N -= 5; break; G:goto a; case 0:V(20); } if(O>39&&!x(0,9)){ V(e = 19); O -= 40; R+=40; } if(M<951) goto W; if (G < 36) goto b; if (x(0,9) > 2) goto n; V(96); if (x(0,1)) goto p; V(97); M-= 60; goto n; p: if (x(0,9)<5) goto t; V(21); M -=100;
|
||||
|
||||
goto n; t: V(22); M -= 85; n:if(m) goto z; m=1; if (x(0,9) < 5) goto w; V(23); z: if(M<1951||W) goto
|
||||
|
||||
U; W=1;
|
||||
if(!d&&!x(0,4)) { V(75); d=1; R+= 50; } if (G<20)w(92)
|
||||
if(!x(0,4)) w(x(0,5)?84:x(0,3)?33:34) if (x(0,9) < 7) goto w; U: goto W; w:V(35); c=1; M-=101; I += 1; j k: M-=10; goto U; W: if(d&&x(0,1)){ V(39); } while(i)heaven:w(i) if (! B && (f ||
|
||||
|
||||
a)) { if(d&&a) V(91); if(T<666) V(B=38); else { Q=a ? 1: Q; h = f?1:h; f=a=0; V(93); T-=666; } } b-=f ? 15
|
||||
|
||||
:h ? 5:0; b-= a ? 5 : Q ? 15 : 0; M+=170; M+=O> 99 ? 30:- 99;
|
||||
|
||||
b-=10; } while (A++<21); } if(b<1) { if(a){ w(40) XX:goto ZZ; } if(f)w(41) w(45) II:goto KK; } w(M>2169?47:36) hell:return 666; g:goto S; h:goto u; E:goto aa; Q: goto H; ff:goto ii; pp: goto qq; rr:goto XX; }
|
||||
@@ -0,0 +1,85 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<time.h>
|
||||
#include<stdlib.h>
|
||||
#include<unistd.h>
|
||||
long x(long y, long z){ return rand()%(z-y+1)+y; }
|
||||
unsigned m,D,Q,v,l,f,X,z,B,i,h,
|
||||
r,u,d,e; long
|
||||
O,R,E,G,O,N, T,R,A,I,L,
|
||||
*o[]={ &O,&R,&E,&G,&O,&N} ,a,t[7],q,M, b=666,c,W;
|
||||
char *y,*p; FILE*K; size_t J;
|
||||
#define w(i) { V(i); V(4); goto hell; goto M; }
|
||||
long Z(long x){ return x * 1663; }
|
||||
#define S(x,z) while(scanf(&y[Z(x)],&z)!=1)while(getchar()!='\n');
|
||||
void V(long x){ printf("%s",&y[Z(x)]); }
|
||||
long k() { return E>0?x(0,99)>49:0; } int main() {
|
||||
switch(1)
|
||||
{ j:if(z)goto A; E*=5; B:
|
||||
printf(&y[Z(12)],T); if(z) { goto f; } goto PP; default: srand(time(0));
|
||||
K=fopen(DATA,"r"); if(!K||getdelim(&y,&J,EOF,K)<0)
|
||||
goto hell; goto M; OO: if(b<1) { if(a){ w(40) PP: goto G; } if(f)w(41) w(45) g:goto S; } w(M>2169?47:45)
|
||||
hell:
|
||||
return
|
||||
666; rr:;
|
||||
|
||||
goto OO; yy:
|
||||
do{ if(b<1||M<0||M>2169){ break; F:V(51); R+=18; goto L; } goto i;
|
||||
|
||||
P:for(X=1; X<--(unsigned){ 7 } ; ){ goto kk; BB:*o[X]+=(X==2?t[X]*5:t[X]); goto HA; TA:++X; goto at; ZZ:; }
|
||||
printf(&y[Z(11)],R,E,G,O,N,T,b,M); if(x(0,1))goto I; R:if(R<14)V(37); if(z) { z=0; l: { if (k()) { if (x(0,9) > 4) { V(52);
|
||||
|
||||
R+=23; if(!x(0,9)){ goto r; L: goto II; } c:; } else{ goto F; r: goto c; qq: { V(53); goto zz; } II:; } } else { goto qq; } zz: E-=9; M-=45; } goto C; y:V(42); S(2,r) switch(r) { M:V(1); v:memset(&t,0,sizeof t); goto
|
||||
N; D:{ if (k()) { goto dd; ii:V(f=79); b -= 80; T/=4; goto jj; ee:; } else { goto oo; dd:V(a=29); T+=70; goto ee; x:V(X+--(
|
||||
unsigned){ 6 } ); if(z){ S(3,
|
||||
|
||||
t[X])if(t[X]<0||t[X]>
|
||||
|
||||
666 ){ V(14); goto x; goto
|
||||
heaven ; ET:L-=t[u]; goto XT; } L=T; for(u
|
||||
|
||||
=0; u < 6; ++u){ goto ET; XT:; }
|
||||
|
||||
if(L<0){ V(46); memset(&t,0,
|
||||
|
||||
sizeof t); goto v; } }
|
||||
|
||||
else{ S(3 ,*(o[X])) if(
|
||||
|
||||
*o[X]<0||*o[X] >
|
||||
666) { V(14);
|
||||
|
||||
goto x; } T=1666-O-R-E-G-0-N; if(T<0){ V(46); O=R=E=G=N=0; goto v; LL:*o[X]=0; uu:++X; goto ZZ; } } goto bb; } } goto s; case 3: goto X; case 1:z=1; M-=45; goto v;
|
||||
case 2:goto T; } goto y;
|
||||
O:{ V(e = 19); O -= 40; R+=40; } goto E; i:if(O<1){ goto d; } else { v=0; } goto P; go: V(81); R+=9; N+=3; goto to;
|
||||
} else{ goto y; HA:T-=X[t]; goto TA; A:for(X=1; X < 6; ){ goto BB; kk:if (*o[X]<0) goto LL; goto uu; QQ:V(B=38); goto JJ; at:; } goto B;
|
||||
} T:l=1; if (E<9){ goto h; } else { goto l; h: V(16); } C: l=0; f:z=0;
|
||||
X:if(R<1){ goto e; U: w(24) K:R-=R
|
||||
>23?23:R>18? 18 : R > 13 ? 13 :
|
||||
R; goto Y; TT:V(v=15); O=0; goto P; } else { goto K; } goto tt; Y:switch(q=x(0,23))
|
||||
{ case 1:V(95); R+=5; break; case 18:V(26); goto Z; case 13:V(28); break;
|
||||
case 2:O-=40; V(71); break; case 3:V(a=76); b-=70; goto W; case 4:V(77); N-=7; M-=7; break; case 5:case
|
||||
10:if(q<6) { goto ha; m: V(56); goto D; o:; } else
|
||||
{ goto m; oo:V(f=62); M-=50; b-=35; s:; } goto Z; a:goto H;
|
||||
case 9:case 19:V(30); goto Z; case 20:V(32); break; case 21 :V(31); break; case 6:goto g; case 16: case 22:V(49); goto Z; case 17:V(72); goto Z;
|
||||
case 7:V(83); M-=10; goto Z; case 8:V(86); R-=30; G-=20; O-=40; V
|
||||
:switch(x(1,9)){ case 2:if(q>9){ switch(x(1,2)){ q:R+=40; goto Y; case 1:{ switch (x(2,5)) { case 2:V(a=54); goto
|
||||
MM; b:w(48)
|
||||
case 3:goto J; N:goto Q; case 4:i=17; } } case 2: V(5); } goto k; u: if(M<1951||W){ goto
|
||||
W; } W=1;
|
||||
if(!d&&!x(0,4)){ V(75); d=1; R+= 50; }
|
||||
if(!x(0,3)){ w(x(0,4)?84:x(0,4)?33:34) e:if(O>39){ V(e=x(0,1)?18:19); O -= 40; goto q; d:{ if(!v)goto TT; goto P; } } goto U; } if (x(0,9) < 5) w:V(35); c=1; M-=101; ++E; k: M-=10; W: if(x(0,1)){ if (d) V(39); if(e)V(25); } while(i)heaven:{ w(i) } if (!B&&(f||
|
||||
a)){ if(d&&a) V(91); if(T<666){ goto QQ; KK:Q=a?1:Q; h=f?1:h; f=a=0; V(93); T-=666; } else{ goto KK; } JJ:; } b-=f?15
|
||||
|
||||
:h?5:0; b-=a?5:Q?15:0; M+=170; M+=O> 99 ? 30:- 99;
|
||||
|
||||
b-=10; goto z; J: V(a=54); } goto k; MM
|
||||
|
||||
:goto k; default: if(q>10) { goto k; } if(q>7) { if(N<5) { w(99) goto M; G:goto yy; } V(13); N-=5; } goto Z; _:goto rr; S:if (E>1999){ w(27) I:goto a; } V(82); M-=9; N-=5; R-=20; goto Z;
|
||||
} M-=17; goto Z; case 14: V(74); break; case 15: V(x(0,1)?69:68);
|
||||
goto Z; ha:V(78); if(k()){ goto go; to:; } else { goto ii; jj:; } goto o; case 11: goto V; case
|
||||
12:V(94); M-=5; b-=19; N -= 5; goto Z; tt: goto Y; case 0:V(20); Z:; } if(O>39&&!x(0,9))goto O; E: if(M<951) goto W; if (G < 36) goto b; if (x(0,9) > 2) goto n; V(96); if (x(0,1)) { goto p; Q: for (X=
|
||||
1; X < 6; ++X) { goto x; bb:; } goto j; } V(97); M-= 60; goto n; H: goto R; p: if (x(0,9)<3) goto t; V(21); M -=99;
|
||||
goto n; t: V(22); M -= 85; n:if(m){ goto u; } m=1; if (x(0,9) > 5) goto w; V(23); z:; } while (A++<21); goto _;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<time.h>
|
||||
#include<stdlib.h>
|
||||
#include<unistd.h>
|
||||
long x(long y, long z){ return rand()%(z-y+1)+y; }
|
||||
unsigned m,D,Q,v,l,f,X,z,B,i,h,
|
||||
r,u,d,e; long
|
||||
O,R,E,G,O,N, T,R,A,I,L,
|
||||
*o[]={ &O,&R,&E,&G,&O,&N} ,a,t[7],q,M, b=666,c,W;
|
||||
char *y,*p; FILE*K; size_t J;
|
||||
#define w(i) { V(i); V(4); goto hell; goto M; }
|
||||
long Z(long x){ return x * 1663; }
|
||||
#define S(x,z) while(scanf(&y[Z(x)],&z)!=1)while(getchar()!='\n');
|
||||
void V(long x){ printf("%s",&y[Z(x)]); }
|
||||
long k() { return E>0?x(0,99)>49:0; } int main() {
|
||||
switch(1)
|
||||
{ j:if(z)goto A; E*=5; B:
|
||||
printf(&y[Z(12)],T); if(z) { goto f; } goto PP; default: srand(time(0));
|
||||
K=fopen(DATA,"r"); if(!K||getdelim(&y,&J,EOF,K)<0)
|
||||
goto hell; goto M; OO: if(b<1) { if(a){ w(40) PP: goto G; } if(f)w(41) w(45) g:goto S; } w(M>2169?47:45)
|
||||
hell:
|
||||
return
|
||||
666; rr:;
|
||||
|
||||
goto OO; yy:
|
||||
do{ if(b<1||M<0||M>2169){ break; F:V(51); R+=18; goto L; } goto i;
|
||||
|
||||
P:for(X=1; X<--(unsigned){ 7 } ; ){ goto kk; BB:*o[X]+=(X==2?t[X]*5:t[X]); goto HA; TA:++X; goto at; ZZ:; }
|
||||
printf(&y[Z(11)],R,E,G,O,N,T,b,M); if(x(0,1))goto I; R:if(R<14)V(37); if(z) { z=0; l: { if (k()) { if (x(0,9) > 4) { V(52);
|
||||
|
||||
R+=23; if(!x(0,9)){ goto r; L: goto II; } c:; } else{ goto F; r: goto c; qq: { V(53); goto zz; } II:; } } else { goto qq; } zz: E-=9; M-=45; } goto C; y:V(42); S(2,r) switch(r) { M:V(1); v:memset(&t,0,sizeof t); goto
|
||||
N; D:{ if (k()) { goto dd; ii:V(f=79); b -= 80; T/=4; goto jj; ee:; } else { goto oo; dd:V(a=29); T+=70; goto ee; x:V(X+--(
|
||||
unsigned){ 6 } ); if(z){ S(3,
|
||||
|
||||
t[X])if(t[X]<0||t[X]>
|
||||
|
||||
666 ){ V(14); goto x; goto
|
||||
heaven ; ET:L-=t[u]; goto XT; } L=T; for(u
|
||||
|
||||
=0; u < 6; ++u){ goto ET; XT:; }
|
||||
|
||||
if(L<0){ V(46); memset(&t,0,
|
||||
|
||||
sizeof t); goto v; } }
|
||||
|
||||
else{ S(3 ,*(o[X])) if(
|
||||
|
||||
*o[X]<0||*o[X] >
|
||||
666) { V(14);
|
||||
|
||||
goto x; } T=1666-O-R-E-G-0-N; if(T<0){ V(46); O=R=E=G=N=0; goto v; LL:*o[X]=0; uu:++X; goto ZZ; } } goto bb; } } goto s; case 3: goto X; case 1:z=1; M-=45; goto v;
|
||||
case 2:goto T; } goto y;
|
||||
O:{ V(e = 19); O -= 40; R+=40; } goto E; i:if(O<1){ goto d; } else { v=0; } goto P; go: V(81); R+=9; N+=3; goto to;
|
||||
} else{ goto y; HA:T-=X[t]; goto TA; A:for(X=1; X < 6; ){ goto BB; kk:if (*o[X]<0) goto LL; goto uu; QQ:V(B=38); goto JJ; at:; } goto B;
|
||||
} T:l=1; if (E<9){ goto h; } else { goto l; h: V(16); } C: l=0; f:z=0;
|
||||
X:if(R<1){ goto e; U: w(24) K:R-=R
|
||||
>23?23:R>18? 18 : R > 13 ? 13 :
|
||||
R; goto Y; TT:V(v=15); O=0; goto P; } else { goto K; } goto tt; Y:switch(q=x(0,23))
|
||||
{ case 1:V(95); R+=5; break; case 18:V(26); goto Z; case 13:V(28); break;
|
||||
case 2:O-=40; V(71); break; case 3:V(a=76); b-=70; goto W; case 4:V(77); N-=7; M-=7; break; case 5:case
|
||||
10:if(q<6) { goto ha; m: V(56); goto D; o:; } else
|
||||
{ goto m; oo:V(f=62); M-=50; b-=35; s:; } goto Z; a:goto H;
|
||||
case 9:case 19:V(30); goto Z; case 20:V(32); break; case 21 :V(31); break; case 6:goto g; case 16: case 22:V(49); goto Z; case 17:V(72); goto Z;
|
||||
case 7:V(83); M-=10; goto Z; case 8:V(86); R-=30; G-=20; O-=40; V
|
||||
:switch(x(1,9)){ case 2:if(q>9){ switch(x(1,2)){ q:R+=40; goto Y; case 1:{ switch (x(2,5)) { case 2:V(a=54); goto
|
||||
MM; b:w(48)
|
||||
case 3:goto J; N:goto Q; case 4:i=17; } } case 2: V(5); } goto k; u: if(M<1951||W){ goto
|
||||
W; } W=1;
|
||||
if(!d&&!x(0,4)){ V(75); d=1; R+= 50; }
|
||||
if(!x(0,3)){ w(x(0,4)?84:x(0,4)?33:34) e:if(O>39){ V(e=x(0,1)?18:19); O -= 40; goto q; d:{ if(!v)goto TT; goto P; } } goto U; } if (x(0,9) < 5) w:V(35); c=1; M-=101; ++E; k: M-=10; W: if(x(0,1)){ if (d) V(39); if(e)V(25); } while(i)heaven:{ w(i) } if (!B&&(f||
|
||||
a)){ if(d&&a) V(91); if(T<666){ goto QQ; KK:Q=a?1:Q; h=f?1:h; f=a=0; V(93); T-=666; } else{ goto KK; } JJ:; } b-=f?15
|
||||
|
||||
:h?5:0; b-=a?5:Q?15:0; M+=170; M+=O> 99 ? 30:- 99;
|
||||
|
||||
b-=10; goto z; J: V(a=54); } goto k; MM
|
||||
|
||||
:goto k; default: if(q>10) { goto k; } if(q>7) { if(N<5) { w(99) goto M; G:goto yy; } V(13); N-=5; } goto Z; _:goto rr; S:if (E>1999){ w(27) I:goto a; } V(82); M-=9; N-=5; R-=20; goto Z;
|
||||
} M-=17; goto Z; case 14: V(74); break; case 15: V(x(0,1)?69:68);
|
||||
goto Z; ha:V(78); if(k()){ goto go; to:; } else { goto ii; jj:; } goto o; case 11: goto V; case
|
||||
12:V(94); M-=5; b-=19; N -= 5; goto Z; tt: goto Y; case 0:V(20); Z:; } if(O>39&&!x(0,9))goto O; E: if(M<951) goto W; if (G < 36) goto b; if (x(0,9) > 2) goto n; V(96); if (x(0,1)) { goto p; Q: for (X=
|
||||
1; X < 6; ++X) { goto x; bb:; } goto j; } V(97); M-= 60; goto n; H: goto R; p: if (x(0,9)<3) goto t; V(21); M -=99;
|
||||
goto n; t: V(22); M -= 85; n:if(m){ goto u; } m=1; if (x(0,9) > 5) goto w; V(23); z:; } while (A++<21); goto _;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 221 KiB |
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 356 KiB |
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate 2024/ferguson1
|
||||
|
||||
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||
# this way allows us to have the user specify a different compiler in an easy way.
|
||||
#
|
||||
[[ -z "$CC" ]] && CC="cc"
|
||||
|
||||
# make sure the program has been built
|
||||
#
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear the screen
|
||||
#
|
||||
clear
|
||||
|
||||
# try the program
|
||||
#
|
||||
read -r -n 1 -p "Press any key to run: ./prog: "
|
||||
echo 1>&2
|
||||
echo 1>&2
|
||||
./prog
|
||||
echo 1>&2
|
||||
Reference in new issue
Block a user