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,97 @@
|
||||
{
|
||||
"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 sound coding",
|
||||
"year" : 2024,
|
||||
"dir" : "anders",
|
||||
"entry_id" : "2024_anders",
|
||||
"title" : "aks",
|
||||
"abstract" : "layered music generator",
|
||||
"author_set" : [
|
||||
{
|
||||
"author_handle" : "Anders_Kaare_Straadt"
|
||||
}
|
||||
],
|
||||
"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.orig.c",
|
||||
"inventory_order" : 50,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "original source code"
|
||||
},
|
||||
{
|
||||
"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" : "2024_anders.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" : "index.html",
|
||||
"inventory_order" : 4294967295,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "html",
|
||||
"display_via_github" : false,
|
||||
"entry_text" : "this web page"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
prog.wav
|
||||
@@ -0,0 +1 @@
|
||||
2024/anders
|
||||
Binary file not shown.
@@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2024/anders
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
|
||||
SHELL= bash
|
||||
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
|
||||
include ../../var.mk
|
||||
|
||||
|
||||
#####################
|
||||
# C compiler settings
|
||||
#####################
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
# NOTE: Please don't add -Wno-unknown-warning-option to CSILENCE
|
||||
# (or to CUNKNOWN)
|
||||
#
|
||||
# NOTE: The author says this about -Wno-unsafe-buffer-usage
|
||||
#
|
||||
# # nah i'm not really into rust
|
||||
#
|
||||
CSILENCE= -Wno-int-in-bool-context -Wno-out-of-line-declaration \
|
||||
-Wno-unsafe-buffer-usage
|
||||
|
||||
# Attempt to silence unknown warning options
|
||||
#
|
||||
CUNKNOWN=
|
||||
|
||||
# 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
|
||||
#
|
||||
# Example: -Dfoo -Dbar=baz
|
||||
#
|
||||
CDEFINE=
|
||||
|
||||
# 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= -lm
|
||||
|
||||
# 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-poison-system-directories -Wno-unknown-warning-option
|
||||
#
|
||||
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}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
# list any data files supplied with your submission
|
||||
#
|
||||
# Example: DATA= curds whey
|
||||
#
|
||||
DATA=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.PHONY: all alt data everything clean clobber
|
||||
|
||||
# how to compile
|
||||
#
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} ${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} -f prog.wav
|
||||
|
||||
|
||||
######################################
|
||||
# optional include of 1337 hacker rulz
|
||||
######################################
|
||||
|
||||
-include 1337.mk ../1337.mk ../../1337.mk
|
||||
@@ -0,0 +1,93 @@
|
||||
## To build:
|
||||
|
||||
``` <!---sh-->
|
||||
make all
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
and then play the resulting `prog.wav` using a sound player.
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
When you run the program, after several moments, a `prog.wav` sound file is produced.
|
||||
|
||||
Using a sound player (you may find `sox(1)` is a good choice), you may enjoy the result.
|
||||
|
||||
Can you figure out how it produces the various layers of instruments?
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
|
||||
### Obfuscations
|
||||
|
||||
- "Helpful" formatting
|
||||
- Character salad
|
||||
- Loop exit trying to hide by a switch statement
|
||||
- Strong string encryption. By that I mean "fmt"=>"gnu".
|
||||
- A `/*{*/` that throws off bracket matching in vim. Begun the editor wars
|
||||
have! (Wait, I'm **on** the vim-team!)
|
||||
- `cm` and `ap` stands for "allpass" and "comb", respectively.
|
||||
- One effect was created with deliberate "memory corruption".
|
||||
|
||||
To encourage tinkering I've obfuscated the song data and program (see Y()) less
|
||||
than the "library code". Sorry if you wanted to tinker with the library code!
|
||||
|
||||
### Sound quality
|
||||
|
||||
The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms
|
||||
would require more code, but you can always oversample the audio and pass the
|
||||
anti-aliasing problem on to the audio player :-) However, the downsampler in my
|
||||
`mplayer(1)` is poor, but you can use the high-quality resampler in `sox(1)` to create a
|
||||
48kHz version:
|
||||
|
||||
``` <!---c--->
|
||||
sox prog.wav -r 48000 prog.48kHz.wav
|
||||
```
|
||||
|
||||
### Tricks (the condescending part)
|
||||
|
||||
- Kick drum from sines, pitched up to create toms.
|
||||
- Roland TR-808 style hi-hats (a bunch of high-pass filtered square waves).
|
||||
- SID/C64-style snare drum (oscillates between noise and square wave).
|
||||
- There's some FM synthesis in the bass.
|
||||
- Schroeder reverberator a la Freeverb. The same building blocks are used for
|
||||
the echo effect.
|
||||
- Waveshaping/overdrive using tanh(x), ohh yeaaah..
|
||||
|
||||
I used this Python snippet to generate `q0[2]` and `q0[3]`:
|
||||
|
||||
``` <!---python-->
|
||||
def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use
|
||||
X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx")
|
||||
X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx")
|
||||
```
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2025 by Landon Curt Noll and Leonid A. Broukhis. 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/
|
||||
|
||||
-->
|
||||
@@ -0,0 +1,638 @@
|
||||
<!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>2024/anders - Prize in sound coding</title>
|
||||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||||
<meta name="description" content="2024 IOCCC entry anders - Prize in sound coding">
|
||||
<meta name="keywords" content="IOCCC, 2024, IOCCC 2024, IOCCC entry, anders, Prize in sound coding">
|
||||
</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/readme2index.sh -->
|
||||
<!-- The content of main section of this web page came from: 2024/anders/README.md -->
|
||||
<!-- -->
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/anders/README.md !!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/anders/README.md !!! -->
|
||||
<!-- !!! Do not modify this web page, instead modify the file: 2024/anders/README.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>2024/anders - Prize in sound coding</h2>
|
||||
<h3>layered music generator</h3>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/header.default.html -->
|
||||
<!-- START: this line starts content from: inc/navbar.mid.html -->
|
||||
|
||||
<div class="navbar">
|
||||
<a class="Left" href="../../2020/yang/index.html">← 2020/yang</a>
|
||||
<a class="Left" href="../index.html">↑ 2024 ↑</a>
|
||||
<a class="Left" href="../burton/index.html">2024/burton →</a>
|
||||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2024/anders/prog.c">C code</a>
|
||||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/2024/anders/Makefile">Makefile</a>
|
||||
<a class="Right" href="#inventory">Inventory</a>
|
||||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F2024%2Fanders%2Findex.html">✓</a>
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/navbar.mid.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 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
|
||||
|
||||
<h2 id="author">Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Anders_Kaare_Straadt">Anders Kaare Straadt</a><br>
|
||||
Location: <a href="../../location.html#DK">DK</a> - <em>Denmark</em></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
|
||||
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||||
<!-- 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/anders/README.md -->
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<pre><code> make all</code></pre>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<pre><code> ./prog</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<pre><code> ./prog</code></pre>
|
||||
<p>and then play the resulting <code>prog.wav</code> using a sound player.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>When you run the program, after several moments, a <code>prog.wav</code> sound file is produced.</p>
|
||||
<p>Using a sound player (you may find <code>sox(1)</code> is a good choice), you may enjoy the result.</p>
|
||||
<p>Can you figure out how it produces the various layers of instruments?</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="obfuscations">Obfuscations</h3>
|
||||
<ul>
|
||||
<li>“Helpful” formatting</li>
|
||||
<li>Character salad</li>
|
||||
<li>Loop exit trying to hide by a switch statement</li>
|
||||
<li>Strong string encryption. By that I mean “fmt”=>“gnu”.</li>
|
||||
<li>A <code>/*{*/</code> that throws off bracket matching in vim. Begun the editor wars
|
||||
have! (Wait, I’m <strong>on</strong> the vim-team!)</li>
|
||||
<li><code>cm</code> and <code>ap</code> stands for “allpass” and “comb”, respectively.</li>
|
||||
<li>One effect was created with deliberate “memory corruption”.</li>
|
||||
</ul>
|
||||
<p>To encourage tinkering I’ve obfuscated the song data and program (see Y()) less
|
||||
than the “library code”. Sorry if you wanted to tinker with the library code!</p>
|
||||
<h3 id="sound-quality">Sound quality</h3>
|
||||
<p>The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms
|
||||
would require more code, but you can always oversample the audio and pass the
|
||||
anti-aliasing problem on to the audio player :-) However, the downsampler in my
|
||||
<code>mplayer(1)</code> is poor, but you can use the high-quality resampler in <code>sox(1)</code> to create a
|
||||
48kHz version:</p>
|
||||
<pre class="<!---c--->"><code> sox prog.wav -r 48000 prog.48kHz.wav</code></pre>
|
||||
<h3 id="tricks-the-condescending-part">Tricks (the condescending part)</h3>
|
||||
<ul>
|
||||
<li>Kick drum from sines, pitched up to create toms.</li>
|
||||
<li>Roland TR-808 style hi-hats (a bunch of high-pass filtered square waves).</li>
|
||||
<li>SID/C64-style snare drum (oscillates between noise and square wave).</li>
|
||||
<li>There’s some FM synthesis in the bass.</li>
|
||||
<li>Schroeder reverberator a la Freeverb. The same building blocks are used for
|
||||
the echo effect.</li>
|
||||
<li>Waveshaping/overdrive using tanh(x), ohh yeaaah..</li>
|
||||
</ul>
|
||||
<p>I used this Python snippet to generate <code>q0[2]</code> and <code>q0[3]</code>:</p>
|
||||
<pre><code> def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use
|
||||
X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx")
|
||||
X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx")</code></pre>
|
||||
<!--
|
||||
|
||||
Copyright © 1984-2025 by Landon Curt Noll and Leonid A. Broukhis. 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/
|
||||
|
||||
-->
|
||||
<!-- AFTER: last line of markdown file: 2024/anders/README.md -->
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<div id="inventory">
|
||||
<h1 id="inventory-for-2024anders">Inventory for 2024/anders</h1>
|
||||
</div>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/prog.c">prog.c</a> - entry source code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/prog.orig.c">prog.orig.c</a> - original source code</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/try.sh">try.sh</a> - script to try entry</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="2024_anders.tar.bz2">2024_anders.tar.bz2</a> - download entry tarball</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/README.md">README.md</a> - markdown source for this web page</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2024/anders/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top level directory</li>
|
||||
<li><a href="index.html">index.html</a> - this web page</li>
|
||||
</ul>
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
<h4>
|
||||
Jump to: <a href="#">top</a>
|
||||
</h4>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.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.inventory.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%2Fanders%2Findex.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> <a href="#inventory">Jump to Inventory</a><br>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- END: this line ends content from: inc/footer.inventory.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,237 @@
|
||||
double static F=
|
||||
1.5e-3
|
||||
,t,b,D[1<<20],*E,U[4],X;
|
||||
|
||||
int static B=
|
||||
17e3
|
||||
,J,I,N;
|
||||
|
||||
unsigned static q0[]={
|
||||
0x0ce97522,
|
||||
0xc02972e5,
|
||||
0xeceddaca,
|
||||
0xfeedfaad,
|
||||
};
|
||||
|
||||
int static q1[]={
|
||||
-2, 0, 7,
|
||||
0, 3, 10,
|
||||
|
||||
-5, 0, 0, 2, 3, 0, 2, 2,
|
||||
-2, 0, 7, 12, 3, 7, 5, 10,
|
||||
|
||||
0, 3, -5,
|
||||
-2, 7, 3,
|
||||
-2, 2, -5,
|
||||
-10,-2, 5
|
||||
}
|
||||
|
||||
; char static*q2[]={
|
||||
"XBWFgnu!" ,
|
||||
"ebub","SJGG" ,
|
||||
"\njust a moment.."
|
||||
} ,*P,M[1<<29]
|
||||
|
||||
#define S sin
|
||||
#define O pow
|
||||
#define H tanh
|
||||
#define C(b)double*j=G(n+2),o; int c=(int)j[n+1]; b; if(++c>=n)c=0; j[n+1]=c; return o;
|
||||
#define A(n)for(j=0; j<n; ++j)
|
||||
; int static T( int x ) { return I/(B<<x) ; }
|
||||
double static dp( int a,int c ){ return (double)((I+B*c)%(B<<a)) /(B<<a); }
|
||||
void static L(short w){ *P++=( char ) w; *P++=w>>3 >>5; }
|
||||
double static Q( int a ) { return dp (a,0); }
|
||||
void static Z(char*s ) { for ( char*q=s; *q; ++q, ++P) *P=*q -1; }
|
||||
double static qb( int p ) { return I%p<p>>2 ?1:-1; }
|
||||
double static* G( int n ) { E+=n; return E -n; }
|
||||
void static W( int l ) { L( ( short )l); L((short)(l>>13 >>3) )
|
||||
; }
|
||||
#include <math.h>
|
||||
#include<stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void static Y(double p, double g, double e, double r)
|
||||
{
|
||||
U[2] += e * X ;
|
||||
U[0] += X * p * fmin(1,1-g) ;
|
||||
U[3] += r * X ;
|
||||
U[1] += fmin(g+1,1) * X * p ;
|
||||
}
|
||||
|
||||
double static eq(double x,double a,double h,double c,double d,double e)
|
||||
{
|
||||
double *z=
|
||||
G(2) , y=a*x+
|
||||
z[0] ;
|
||||
z[0] = x*h-d*y+
|
||||
z[1] ;
|
||||
z[1] = c*x-y*e;
|
||||
return y;
|
||||
}
|
||||
|
||||
double static ap(double x,int n,double f,double d) { C (
|
||||
o=
|
||||
j[c] ;
|
||||
j[n] =o* (1-d)+
|
||||
j[n] *d;
|
||||
j[c] =x+
|
||||
j[n] *f
|
||||
;
|
||||
)
|
||||
} double static cm
|
||||
( double x,int n,double
|
||||
f )
|
||||
{ C
|
||||
( double u=
|
||||
j [c ]; o=u-x;
|
||||
j[c ] =f*u+x; )
|
||||
} int
|
||||
main
|
||||
( void )
|
||||
{ int j ,
|
||||
k , l , m ;
|
||||
char * px = P
|
||||
= M
|
||||
,
|
||||
* pa ,
|
||||
*
|
||||
p0 ; FILE
|
||||
* o ;
|
||||
|
||||
|
||||
|
||||
N=(B*5)<<8;
|
||||
|
||||
|
||||
|
||||
Z ( q2 [ 2 ] ) ; W
|
||||
( 36 + ( N << 2 ) ) ;
|
||||
Z ( q2 [ 0 ] )
|
||||
; W ( 16 ) ;
|
||||
L ( 1 ) ; L ( 2
|
||||
) ; W ( 1 << 18
|
||||
) ; W ( 4 << 18
|
||||
) ; L ( 4 ) ;L
|
||||
( 16 ) ; Z ( q2
|
||||
[1 ] ) ; W(N <<
|
||||
2) ; for( pa = P ; ;
|
||||
) { E= D ; A ( 4 )
|
||||
U [ j ] = 0 ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
l=((T(3)+32)%64)-61;
|
||||
t=H(Q((l<0?3:l)));
|
||||
X=H(50*S(t*141+t*(15e3/(4+t*330)))*O(1-H(t),9));
|
||||
if (T(10)) X=0;
|
||||
Y(.5,0,.07,.1);
|
||||
|
||||
|
||||
X=0;
|
||||
A(8) X+=qb(211+(j*113+T(2)*91)%1291);
|
||||
X=eq(X,.973,-1.946,.973,-1.942,.951);
|
||||
X=H(X*2);
|
||||
l=T(4)%8>6;
|
||||
switch (T(8)) {
|
||||
case 0 : t=H(Q((T(4))%4)); break;
|
||||
case 2 : t=H(Q(2-l)); break;
|
||||
default : case 1 : t=H(Q(1-l)); break;
|
||||
} if (++I>N) break;
|
||||
X*=O(1-t,4)*O(Q(3),2);
|
||||
X=H(X*1.4);
|
||||
if (!(T(7)&7) || T(10)) X=0;
|
||||
Y(.8,S(I*1e-5),.16,.4);
|
||||
|
||||
|
||||
t=1-(((T(2)&63)>61)?H(Q(1))/6:H(dp(4,8)));
|
||||
X=I&(1<<12)?(double)(rand())/RAND_MAX-.5:.1*qb(1400-(int)(t*301));
|
||||
X=H(30*X*O(t,40));
|
||||
if (!(T(7)&3) || T(10)) X=0;
|
||||
Y(.8,.3,1,.3);
|
||||
|
||||
l=T(6)%4;
|
||||
k=(q0[l>2]>>((T(3)&7)<<2))&15;
|
||||
b=F*I*O(2,(double)k/12);
|
||||
k=T(8)%2;
|
||||
m=((q0[2+l%2])>>(T(1)&31))&1;
|
||||
X=m?S(b+1.5*S(I*7e-5)+S(I*3e-7)*(4+3*S(I*1.7e-7))*S(b*(1+k))):0;
|
||||
if (T(8)) X+=((S(b*.501)>.95)-(S(b*.498)>.8))*15*O(Q(3),2);
|
||||
t=1-H(Q(1));
|
||||
X=H(25*X*O(t,3));
|
||||
if (T(10)) X=0;
|
||||
Y(.4,0,.12,.02);
|
||||
|
||||
|
||||
A(3) {
|
||||
k=T(1)%32+3;
|
||||
k-=k/4*3;
|
||||
l=T(6)&1;
|
||||
k=l ? 24+q1[6 + T(7)%2*8 + T(3)%8] : T(9) ? 24+q1[22+(k+j)%3+T(4)%4*3] : q1[k%3+T(7)%2*3] + (k/3)*12;
|
||||
X=F*I*O(2,((double)(14+k)+(j-1)*.4)/12)+S(j+I*(l?1e-4:3e-4))*(l?4:1);
|
||||
t=S(X)+.3*(fmod(X,6.3)-3);
|
||||
X=t+.3*(t>.9*S(I*6.3e-7)?1:-1);
|
||||
t=1-H(Q(l?2:m?2:1));
|
||||
X=H(X*O(t,9)*(T(10)?O(1-Q(8),3):1));
|
||||
if (T(6)%2*!T(9) || !T(8)) X=0;
|
||||
Y( 1,S(2*j+I*3e-6),.3,.3);
|
||||
}
|
||||
|
||||
X=ap(U[3],(int)(B*6.1),.2,.2);
|
||||
Y(1,-.6,.1,0);
|
||||
X=cm(U[3],(int)(B*3.8),.2);
|
||||
Y(.7,.6,.1,0);
|
||||
|
||||
|
||||
for (k=0; k<2; ++k) {
|
||||
X=0;
|
||||
A(8) X+=ap(U[2],4001+(j*2131+k*1555)%3491,.8,.5);
|
||||
A(4) X=cm(X,800+((j+T(8))*1337+k*1441)%1303,.4);
|
||||
X=H(X/4);
|
||||
Y( .3,k?-1:1,0,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
A(
|
||||
2)
|
||||
L (
|
||||
( short)
|
||||
(fmin (1
|
||||
,fmax (-1,
|
||||
U [
|
||||
j ]
|
||||
) ) *32e3
|
||||
) ); if ( !
|
||||
( I %(
|
||||
B * 8) ) )
|
||||
{ putchar (q2
|
||||
[3 ]
|
||||
/*{*/[
|
||||
++J&15 ] ) ;
|
||||
fflush ( stdout ) ;
|
||||
} } pa=P ;
|
||||
Z("opx!fokpz!" ); p0=P ;
|
||||
Z("qsph/xbw" );
|
||||
o=fopen(p0,"wb") ; fwrite(
|
||||
px, 1, (
|
||||
|
||||
unsigned
|
||||
long )( pa-px),o); fclose(
|
||||
o); puts ( pa ) ; return(
|
||||
|
||||
signed
|
||||
)0; }
|
||||
@@ -0,0 +1,237 @@
|
||||
double static F=
|
||||
1.5e-3
|
||||
,t,b,D[1<<20],*E,U[4],X;
|
||||
|
||||
int static B=
|
||||
17e3
|
||||
,J,I,N;
|
||||
|
||||
unsigned static q0[]={
|
||||
0x0ce97522,
|
||||
0xc02972e5,
|
||||
0xeceddaca,
|
||||
0xfeedfaad,
|
||||
};
|
||||
|
||||
int static q1[]={
|
||||
-2, 0, 7,
|
||||
0, 3, 10,
|
||||
|
||||
-5, 0, 0, 2, 3, 0, 2, 2,
|
||||
-2, 0, 7, 12, 3, 7, 5, 10,
|
||||
|
||||
0, 3, -5,
|
||||
-2, 7, 3,
|
||||
-2, 2, -5,
|
||||
-10,-2, 5
|
||||
}
|
||||
|
||||
; char static*q2[]={
|
||||
"XBWFgnu!" ,
|
||||
"ebub","SJGG" ,
|
||||
"\njust a moment.."
|
||||
} ,*P,M[1<<29]
|
||||
|
||||
#define S sin
|
||||
#define O pow
|
||||
#define H tanh
|
||||
#define C(b)double*j=G(n+2),o; int c=(int)j[n+1]; b; if(++c>=n)c=0; j[n+1]=c; return o;
|
||||
#define A(n)for(j=0; j<n; ++j)
|
||||
; int static T( int x ) { return I/(B<<x) ; }
|
||||
double static dp( int a,int c ){ return (double)((I+B*c)%(B<<a)) /(B<<a); }
|
||||
void static L(short w){ *P++=( char ) w; *P++=w>>3 >>5; }
|
||||
double static Q( int a ) { return dp (a,0); }
|
||||
void static Z(char*s ) { for ( char*q=s; *q; ++q, ++P) *P=*q -1; }
|
||||
double static qb( int p ) { return I%p<p>>2 ?1:-1; }
|
||||
double static* G( int n ) { E+=n; return E -n; }
|
||||
void static W( int l ) { L( ( short )l); L((short)(l>>13 >>3) )
|
||||
; }
|
||||
#include <math.h>
|
||||
#include<stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void static Y(double p, double g, double e, double r)
|
||||
{
|
||||
U[2] += e * X ;
|
||||
U[0] += X * p * fmin(1,1-g) ;
|
||||
U[3] += r * X ;
|
||||
U[1] += fmin(g+1,1) * X * p ;
|
||||
}
|
||||
|
||||
double static eq(double x,double a,double h,double c,double d,double e)
|
||||
{
|
||||
double *z=
|
||||
G(2) , y=a*x+
|
||||
z[0] ;
|
||||
z[0] = x*h-d*y+
|
||||
z[1] ;
|
||||
z[1] = c*x-y*e;
|
||||
return y;
|
||||
}
|
||||
|
||||
double static ap(double x,int n,double f,double d) { C (
|
||||
o=
|
||||
j[c] ;
|
||||
j[n] =o* (1-d)+
|
||||
j[n] *d;
|
||||
j[c] =x+
|
||||
j[n] *f
|
||||
;
|
||||
)
|
||||
} double static cm
|
||||
( double x,int n,double
|
||||
f )
|
||||
{ C
|
||||
( double u=
|
||||
j [c ]; o=u-x;
|
||||
j[c ] =f*u+x; )
|
||||
} int
|
||||
main
|
||||
( void )
|
||||
{ int j ,
|
||||
k , l , m ;
|
||||
char * px = P
|
||||
= M
|
||||
,
|
||||
* pa ,
|
||||
*
|
||||
p0 ; FILE
|
||||
* o ;
|
||||
|
||||
|
||||
|
||||
N=(B*5)<<8;
|
||||
|
||||
|
||||
|
||||
Z ( q2 [ 2 ] ) ; W
|
||||
( 36 + ( N << 2 ) ) ;
|
||||
Z ( q2 [ 0 ] )
|
||||
; W ( 16 ) ;
|
||||
L ( 1 ) ; L ( 2
|
||||
) ; W ( 1 << 18
|
||||
) ; W ( 4 << 18
|
||||
) ; L ( 4 ) ;L
|
||||
( 16 ) ; Z ( q2
|
||||
[1 ] ) ; W(N <<
|
||||
2) ; for( pa = P ; ;
|
||||
) { E= D ; A ( 4 )
|
||||
U [ j ] = 0 ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
l=((T(3)+32)%64)-61;
|
||||
t=H(Q((l<0?3:l)));
|
||||
X=H(50*S(t*141+t*(15e3/(4+t*330)))*O(1-H(t),9));
|
||||
if (T(10)) X=0;
|
||||
Y(.5,0,.07,.1);
|
||||
|
||||
|
||||
X=0;
|
||||
A(8) X+=qb(211+(j*113+T(2)*91)%1291);
|
||||
X=eq(X,.973,-1.946,.973,-1.942,.951);
|
||||
X=H(X*2);
|
||||
l=T(4)%8>6;
|
||||
switch (T(8)) {
|
||||
case 0 : t=H(Q((T(4))%4)); break;
|
||||
case 2 : t=H(Q(2-l)); break;
|
||||
default : case 1 : t=H(Q(1-l)); break;
|
||||
} if (++I>N) break;
|
||||
X*=O(1-t,4)*O(Q(3),2);
|
||||
X=H(X*1.4);
|
||||
if (!(T(7)&7) || T(10)) X=0;
|
||||
Y(.8,S(I*1e-5),.16,.4);
|
||||
|
||||
|
||||
t=1-(((T(2)&63)>61)?H(Q(1))/6:H(dp(4,8)));
|
||||
X=I&(1<<12)?(double)(rand())/RAND_MAX-.5:.1*qb(1400-(int)(t*301));
|
||||
X=H(30*X*O(t,40));
|
||||
if (!(T(7)&3) || T(10)) X=0;
|
||||
Y(.8,.3,1,.3);
|
||||
|
||||
l=T(6)%4;
|
||||
k=(q0[l>2]>>((T(3)&7)<<2))&15;
|
||||
b=F*I*O(2,(double)k/12);
|
||||
k=T(8)%2;
|
||||
m=((q0[2+l%2])>>(T(1)&31))&1;
|
||||
X=m?S(b+1.5*S(I*7e-5)+S(I*3e-7)*(4+3*S(I*1.7e-7))*S(b*(1+k))):0;
|
||||
if (T(8)) X+=((S(b*.501)>.95)-(S(b*.498)>.8))*15*O(Q(3),2);
|
||||
t=1-H(Q(1));
|
||||
X=H(25*X*O(t,3));
|
||||
if (T(10)) X=0;
|
||||
Y(.4,0,.12,.02);
|
||||
|
||||
|
||||
A(3) {
|
||||
k=T(1)%32+3;
|
||||
k-=k/4*3;
|
||||
l=T(6)&1;
|
||||
k=l ? 24+q1[6 + T(7)%2*8 + T(3)%8] : T(9) ? 24+q1[22+(k+j)%3+T(4)%4*3] : q1[k%3+T(7)%2*3] + (k/3)*12;
|
||||
X=F*I*O(2,((double)(14+k)+(j-1)*.4)/12)+S(j+I*(l?1e-4:3e-4))*(l?4:1);
|
||||
t=S(X)+.3*(fmod(X,6.3)-3);
|
||||
X=t+.3*(t>.9*S(I*6.3e-7)?1:-1);
|
||||
t=1-H(Q(l?2:m?2:1));
|
||||
X=H(X*O(t,9)*(T(10)?O(1-Q(8),3):1));
|
||||
if (T(6)%2*!T(9) || !T(8)) X=0;
|
||||
Y( 1,S(2*j+I*3e-6),.3,.3);
|
||||
}
|
||||
|
||||
X=ap(U[3],(int)(B*6.1),.2,.2);
|
||||
Y(1,-.6,.1,0);
|
||||
X=cm(U[3],(int)(B*3.8),.2);
|
||||
Y(.7,.6,.1,0);
|
||||
|
||||
|
||||
for (k=0; k<2; ++k) {
|
||||
X=0;
|
||||
A(8) X+=ap(U[2],4001+(j*2131+k*1555)%3491,.8,.5);
|
||||
A(4) X=cm(X,800+((j+T(8))*1337+k*1441)%1303,.4);
|
||||
X=H(X/4);
|
||||
Y( .3,k?-1:1,0,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
A(
|
||||
2)
|
||||
L (
|
||||
( short)
|
||||
(fmin (1
|
||||
,fmax (-1,
|
||||
U [
|
||||
j ]
|
||||
) ) *32e3
|
||||
) ); if ( !
|
||||
( I %(
|
||||
B * 8) ) )
|
||||
{ putchar (q2
|
||||
[3 ]
|
||||
/*{*/[
|
||||
++J&15 ] ) ;
|
||||
fflush ( stdout ) ;
|
||||
} } pa=P ;
|
||||
Z("opx!fokpz!" ); p0=P ;
|
||||
Z("qsph/xbw" );
|
||||
o=fopen(p0,"wb") ; fwrite(
|
||||
px, 1, (
|
||||
|
||||
unsigned
|
||||
long )( pa-px),o); fclose(
|
||||
o); puts ( pa ) ; return(
|
||||
|
||||
signed
|
||||
)0; }
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate 2024/anders
|
||||
|
||||
# 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