Add preview of 1984-2019
The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.
One will find HTML commented out with:
<!-- XXX remove when 2020 is ready
2020 links here
XXX remove when 2020 is ready -->
The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks. Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known. The following files
have such HTML comment blocks in them.
./winners.html
./years-spoiler.html
./years.html
In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.
The 2020 winner code AND write-ups are NOT part of this set.
p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
1 parent
28efc67f5d
commit
c0663537cb
1683 files changed
+220064
No files matched your search
@@ -0,0 +1,58 @@
|
||||
USER MANUAL
|
||||
===========
|
||||
|
||||
Calling the program
|
||||
-------------------
|
||||
|
||||
./prog "`cat prog.c`" "`cat musicfile`" > output.pbm
|
||||
display output.pbm
|
||||
|
||||
This minimalistic music notator expects two command line arguments. The first is the font description embedded in the source code. Notice that you don't pass the file name, but the actual content as one long character string! If you want to define your personal music font, you can of course do so. The file layout must be exactly the same as prog.c though, only the locations of space (" ") may differ.
|
||||
|
||||
The second argument is the actual music. Again it is one long string, not a file name. But it is possible to save your music in a file, of course.
|
||||
|
||||
Output should be redirected to a file. Afterwards, this file can be visualised with various viewers.
|
||||
|
||||
|
||||
Music input
|
||||
-----------
|
||||
|
||||
Every element in the music is given by a string of *exactly* 3 characters. Any violation of this will result in the rest of the music being interpreted in some randomly wrong way. Notice that in a file, the newline is also a character! Therefore, when preparing music in a file, care shold be taken that the last musical element of a line is only 2 characters!
|
||||
|
||||
1. Basic notes:
|
||||
A single note is input by a letter [A-Ga-g] followed by a duration [1,2,4,8] and possibly a dot [.]. The notes cover 2 octaves, from C (lowest) to b (highest). The possible durations are 1 (whole note), 2 (half note), 4 (quaver), 8 (semi-quaver). So a dotted quaver A followed by a semi quaver G is input as "A4.G8 "
|
||||
|
||||
2. Rests:
|
||||
A rest is given by the letter [r] followed by a duration [1,2,4,8].
|
||||
|
||||
3. Bar lines:
|
||||
There are three possible barline types: single (": "), double (":: ") and final (":; ").
|
||||
|
||||
4. Accidentals:
|
||||
Chromatic changes (sharp, flat, natural) are entered separately from the note that folows them! They are a three-character sequence by themselves. The first character is the chromatic change [+-=]. The second is the pitch at which it should be drawn. Thus "+G G4 " will draw a G sharp quaver. Notice that these signs do not necessarily have to be followed by a note. "+f +c +g B2 " is perfectly legal.
|
||||
|
||||
5. Space (formatting):
|
||||
To manually change the spacing of the music, you can add space between different musical elements. This is given by a [s] followed by the amount of space."s3 " is the space taken by one note. This length is given in 1 character. However, to get a value larger than 9, you can just continue along the ASCII table. So "sz " gives you quite a lot of space on a staff. "s0 " is not only meaningless, it can cause nasty results.
|
||||
|
||||
6. New staff:
|
||||
A token "x " signifies to start a new staff of music. A music staff may never be empty! Even if you just put some blank space ("s1 "), you should always have an entry for every staff. "x x " may give nasty results.
|
||||
|
||||
All staves in the output are extended to the length of the longest staff. To have nicely formatted music, though, you will probably have to add spaces manually.
|
||||
|
||||
7. Time signatures:
|
||||
A time signature is given by [m][234][234]. For example, "m24" will give you a two fourth signature. Notice that there are only three available numbers. Especially "6" and "8" are dearly missed.
|
||||
|
||||
8. Clef:
|
||||
The clef (G or F) can only be changed at the beginning of the music input. If the music starts with "KF ", the music will be written in a bass cleff. "K" followed by any other letter will just default to a standard G clef.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Blank music paper (with G cleff):
|
||||
./prog "`cat prog.c`" "sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm
|
||||
with an F cleff:
|
||||
./prog "`cat prog.c`" "KF sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm
|
||||
|
||||
Notice how only the first staff (or any staff) needs to have the full length.
|
||||
|
||||
Some files with well-known melodies are included as examples.
|
||||
@@ -0,0 +1,203 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2012 makefile
|
||||
#
|
||||
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
|
||||
# is licensed under:
|
||||
#
|
||||
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
#
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
|
||||
################
|
||||
# tool locations
|
||||
################
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
CP= cp
|
||||
CPP= cpp
|
||||
GUNZIP= gunzip
|
||||
LD= ld
|
||||
MAKE= make
|
||||
RM= rm
|
||||
SED= sed
|
||||
TAR= tar
|
||||
TRUE= true
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
X11_LIBDIR= /usr/X11R6/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
X11_INCDIR= /usr/X11R6/include
|
||||
|
||||
# Compiler warnings
|
||||
#
|
||||
#CWARN=
|
||||
CWARN= -Wall -W
|
||||
#CWARN= -Wall -W -pedantic
|
||||
|
||||
# compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=c99
|
||||
|
||||
# compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitess:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
OPT= -O2
|
||||
#OPT= -O3
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
|
||||
# default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
|
||||
|
||||
# ANSI compiler
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
#
|
||||
# Some entries seem to need gcc. If you have gcc, set
|
||||
# both CC and MAY_NEED_GCC to gcc.
|
||||
#
|
||||
# If you do not have gcc, set CC to the name of your ANSI compiler, and
|
||||
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
|
||||
# to disable such programs.
|
||||
#
|
||||
CC= cc
|
||||
#CC=clang
|
||||
MAY_NEED_GCC= gcc
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= deckmyn
|
||||
DATA= MANUAL example_beethoven example_greensleeves
|
||||
ALT_OBJ=
|
||||
ALT_ENTRY=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: ${ENTRY} ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
${ENTRY}: ${ENTRY}.c
|
||||
${CC} ${CFLAGS} $< -o $@
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: ${ALT_ENTRY}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
clean:
|
||||
${RM} -f ${ENTRY}.o ${ALT_OBJ}
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${ENTRY} ${ALT_ENTRY}
|
||||
|
||||
nuke: clobber
|
||||
@${TRUE}
|
||||
|
||||
dist_clean: nuke
|
||||
@${TRUE}
|
||||
|
||||
install:
|
||||
@echo "Surely you're joking Mr. Feynman!"
|
||||
@${TRUE}
|
||||
|
||||
# backwards compatibility
|
||||
#
|
||||
build: all
|
||||
@${TRUE}
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'waste'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo you expected to mis-understand this $${RANDOM} magic
|
||||
@echo chongo '<was here>' "/\\oo/\\"
|
||||
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
|
||||
|
||||
# Understand the history of "I Am the Walrus" and
|
||||
# and in particular John Lennon's remarks on that
|
||||
# song and you might be confused about these next
|
||||
# rules in a different way. :-)
|
||||
#
|
||||
supernova: nuke
|
||||
@-if [ -r .code_anal ]; then \
|
||||
${RM} -f .code_anal_v3; \
|
||||
else \
|
||||
echo "You are not expected to understand this"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
deep_magic:
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
|
||||
else \
|
||||
echo "Understand different"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
magic: deep_magic
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
|
||||
else \
|
||||
echo "These aren't the droids you're looking for Mr. Spock!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
@@ -0,0 +1,97 @@
|
||||
#include<stdio.h>
|
||||
#define c(C) printf("%c",C)
|
||||
#define C(c) ((int*)(C[1]+6))[c]
|
||||
main(int c,char
|
||||
*C[]) {(C[c]=C[
|
||||
1]+2 )[0]= c(52*c(\
|
||||
'C'+ '4'/4) );for(c
|
||||
=0; c<491;++ c)for(*
|
||||
*C= C[1]['c' +c] =
|
||||
0;* C[0]<8;( ** C
|
||||
)++ )C[1][c+ 'c']=
|
||||
*(C[ 1]+c+'c')+ C[1][
|
||||
99+ c]+(C[1 ][**C
|
||||
+8*c +99]==32 ); (
|
||||
*C)[4]=*C[2]== 75 ?
|
||||
*((C[2]+=3)-2 )==70?
|
||||
1:0:0;C(0)=C( 1)=c=0
|
||||
;while(*C[2]? C[2][1]
|
||||
?*(C[2]+2)?1 :0:0:0)
|
||||
{if( *C [2 ]>'w'){
|
||||
C(1)=0;C[1] [2]++;*C
|
||||
[2]=0;}else C(1)+=*C[
|
||||
2]==58?2+( C[2][3]&&
|
||||
*(C[2]+3)< 'x'):*C[2]
|
||||
=='s'?(C[ 2][1]-=48):
|
||||
*C[2]>=65 ?3-(*C[2]==\
|
||||
'm'?1:0) :1;C(0)=C(1)>
|
||||
C(0)?C(1 ):C(0);c+=3;*
|
||||
(C+2)+=3;}printf(" %d\
|
||||
%d\n", 56+8*C( 0),80**(C[3] ++))
|
||||
;*C[2]=0 ;C[2] -=c;*C[3] =0;
|
||||
while(C[3] [1,- 1]--){; for( **
|
||||
C=0 ;* *C< 80;(** C)++) {C
|
||||
[2] -=3 ** C[3]; *C[3] ++
|
||||
=0; *C[ 3] =**C>= 51||* *C<
|
||||
18 ||* *C %8!=2?0 :255 ;c(1
|
||||
-1 );c (*C [3]);for( (*C)[
|
||||
1] =0;( *C)[ 1]<3;(*C)[1] ++)c(*C
|
||||
[3 ]|(( *C)[ 4]?**C>18&&* *C<42 ?C[1][
|
||||
42 +*(* C+1) +3***C]:0: **C>= 11&&*
|
||||
*C <64? ~C[1 ][ 7***C+97 +(*C)[ 1]]:
|
||||
0) );c( *C[3 ]++) ;for(C (1)=0; (C(
|
||||
2) =C(1 ))<C (0);) {(*C) [2]=C [2][
|
||||
1] -49; c=(* C[2]<= 63); c=(* C)[0]
|
||||
-4 *(C[ 3][0 ]=105- C[2][ c] -7*(*(C
|
||||
[2]+c)< 'c') -18*( C[2][c ]<77)+2*(
|
||||
*C)[4 ]-7* (C[2] [c]<'C' ))-6;for(C(
|
||||
3)=0;
|
||||
C(3)< (*C[2]?*C[2
|
||||
]>'r' ?C[ 2][1]:(1
|
||||
+2*(*C [2]> 64) +(2-!C[2 ][3])
|
||||
*(58 == (*(C +2))[0])-
|
||||
(C[2] [0 ]=='m' ) ):C(2)?C(0 )-C(
|
||||
2):0 );C(3)++) C(1)+=c(C [1][4]|(* C[2]&&
|
||||
*C[2 ]<'s'?*C[2] ==58?C(3) ==1?**C >17&&**C
|
||||
<51 ?C[ 2] [1] ==59?39: C[2][1 ]==58?9:1:
|
||||
0:0 :63 >* C[2 ]?(c<7&& c>-9?C[1 ][(*C[2]<
|
||||
45? 'c' *5 +2* '%':*C[ 2]< 61?570 :571)+
|
||||
3*c ]: 0) :*C [2]>'o' ?**C>26&&**C<29 &&!
|
||||
(*C )[ 2] ||( *C)[2] ==1&&(&*C[0]) [0]
|
||||
<34 && 31 <** C?C(3) <2?15+225*C(3 ):0:(
|
||||
*C)[ 2] == 3?C (3)<2 &&**C>22&&**C <45&&C
|
||||
(3)< 2? C[ 1][7* *(*C)+151+C (3)]:0:
|
||||
7==( *C )[2 ]&&* *C>26&&**C <42&&C(3
|
||||
)<2?C [1 ][7 ***C +135+C(3)] :0:*C[2]
|
||||
<'k'? (c >-5 && c<5?C(3
|
||||
)<2?C [1][( (*C) [2]<3?
|
||||
207:205)+7* c+C(3 )]:C[
|
||||
2][2]==46 && (c==-2|| c==-
|
||||
1- 2*(*C[3]%2 ))?
|
||||
96 :0:0)|((*C)[2
|
||||
]?
|
||||
C( 3 ) ?C(3)< 2
|
||||
&& *C[3]> 7 &&
|
||||
c< 1&&c >-24 ?8:0:* C
|
||||
[3 ]<8&&c >1 &&c<24 ? ' '
|
||||
:0 :0) |(C(3) <2 &&( ** C
|
||||
==66 && *C[3 ]>14 ||* C[ 3
|
||||
]>12 && 58 ==**C|| *
|
||||
C[3 ]< 2 &&**C==10 ) ?
|
||||
5* 51: 0)|(7== (
|
||||
*C)[ 2]?*C[3] <
|
||||
8?c>13&& c<23&&C(3)<2?C
|
||||
[1][144+ 7*c+C(3)]:0:C(
|
||||
3) && c< -14&&c>- 24?C[
|
||||
1] [7 *c +400+C(3 )]:0:
|
||||
0) :! C (3)?**C> 21&&C
|
||||
[0 ][ 0] <32
|
||||
?C [ 1 ] [(
|
||||
* C ) [2 ] +323
|
||||
+7 ** *C ]:36
|
||||
+ 1 < ** C&& '0'>
|
||||
* *C ? C[1][
|
||||
C[ 2] [2]+162
|
||||
+ 7* **C]:0:0:0));C[1
|
||||
][ 3] ++;C[2]+=3;}c(0)
|
||||
;C [3 ]-=2;}*C[3]=0;}}
|
||||
@@ -0,0 +1,4 @@
|
||||
m44e2 f4 g4 : g4 f4 e4 d4 : c4 c4 d4 e4 : e4.d8 d2 :
|
||||
e2 f4 g4 : g4 f4 e4 d4 : x c4 c4 d4 e4 : d4.c8 c2 ::
|
||||
d2 e4 c4 : d4 e8 f8 e4 c4 : d4 e8 f8 e4 d4 : x c4 d4 G2 :
|
||||
e4 e4 f4 g4 : g4 f4 e4 d4 : c4 c4 d4 e4 : d4.c8 c2 :;
|
||||
@@ -0,0 +1,8 @@
|
||||
m34A4 : c2 d4 : e4.+f f8 e4 : d2 B4 : G4.A8 B4 :
|
||||
c2 A4 : A4.G8 A4 : B2 G4 : E2 A4 : x
|
||||
c2 s1 d4 : e4.+f f8 e4 : d2 s1 B4 : G4.A8 B4 : c4.B8 A4 :
|
||||
+G G4.+F F8 G4 : s2 A2.s2 : s2 A2.s1 :: x
|
||||
g2.s2 : g4.+f f8 e4 : d2 s2 B4 : G4.A8 B4 : c2 s3 A4 :
|
||||
A4.s1 G8 s1 A4 : B2 s1 G4 : s2 E2.s2 : x
|
||||
g2.s2 : g4.+f f8 e4 : d2 s2 B4 : G4.A8 B4 : c4.B8 A4 :
|
||||
+G G4.+F F8 G4 : s2 A2.s2 : s2 A2.s2 :;
|
||||
@@ -0,0 +1,122 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.5a DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Most notable and best tool</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Most notable and best tool</h1>
|
||||
|
||||
<p>Alex Deckmyn<br>
|
||||
<a href="mailto:alex.deckmyn@gmail.com">alex.deckmyn@gmail.com</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make deckmyn
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code># A shell interpreter with proper backtick interpolation is required
|
||||
./deckmyn "`cat deckmyn.c`" "`cat musicfile.txt`" > sheetmusic.pbm
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>The C of this entry is definitely sharp. The program cleverly uses its own
|
||||
source at runtime to define the notes, time signature and accidental bitmaps.</p>
|
||||
|
||||
<p>In addition to sheet music, this program is also able, given the right input,
|
||||
to generate an image of a 10-pin DIP chip (a sound processor?).</p>
|
||||
|
||||
<p>Ironically, the way this entry is called from the command line is an abuse of C Shell.
|
||||
Please use Bourne-family shells to run this entry.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<h1>Example use</h1>
|
||||
|
||||
<p>You need the source code and example input (either one of the example files, or manual input as below) ready. And a program capable of showing .pbm bitmap format.</p>
|
||||
|
||||
<pre><code>./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
|
||||
display greensleeves.pbm
|
||||
|
||||
./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " > short_bass.pbm
|
||||
display short_bass.pbm
|
||||
</code></pre>
|
||||
|
||||
<h1>Description</h1>
|
||||
|
||||
<p>Every major C competition should have an entry capable of producing C major.
|
||||
This is a music notation program. It produces bitmaps (.pbm) of music based on ASCII input. A full manual is added as a separate file. Some musical examples are also included.</p>
|
||||
|
||||
<p>The program is capable of printing notes, rests, (double) bar lines and accidentals on a single melodic line (multiple staves). No chords, polyphony etc.</p>
|
||||
|
||||
<p>The program expects <em>two command line arguments</em>. The first is a (very long) string that contains the complete music font. Note that it should <em>not</em> be given as a file name! The default music font is encoded in the (whitespace of the) source code deckmyn.c itself. Therefore, the first argument should be “<code>cat deckmyn.c</code>”.</p>
|
||||
|
||||
<p>The second command line argument is the music itself. This is, again, a string, not a file name. All music signs are entered as tokens of exactly 3 characters. The code is very sensitive to bad spacing! So for instance, if you use a file to write the music (e.g. example_greensleeves), you should keep in mind that newline is also a character!</p>
|
||||
|
||||
<h1>Internals</h1>
|
||||
|
||||
<p>To minimise the memory footprint, this program has <em>no variable declarations at all</em>, except for the arguments to main(). The only available memory space is from the command line arguments and count (argv and argc). Parts of argv are cast as integer when values under 0 or beyond 127 are expected.</p>
|
||||
|
||||
<p>The “music font” is defined by the source code itself. The first few lines are not part of the font definition, as this memory space will modified by the program. (So as required by the rules, it is only a (memory) copy of the source code that is modified.)</p>
|
||||
|
||||
<p>As there is no memory available, output is directly to stdout, byte by byte, from the top left to the bottom right pixel.</p>
|
||||
|
||||
<h1>LIMITATIONS</h1>
|
||||
|
||||
<p>The memory locations of argv are used for various purposes. Therefore, the program name (default “deckmyn”) must be <em>at least 4 characters long</em>, including possibly the path. This, along with the ending ‘\0’, gives minimum 5 bytes of useful memory space. Otherwise, the program may attempt to write outside the string.</p>
|
||||
|
||||
<p>The code is quite sensitive. Errors in the input can lead to strange results. The code does not read beyond the end of the music input, but that is about the only error checking available. Any input that is not according to the rules in the MANUAL, may cause errors.</p>
|
||||
|
||||
<p>The program has no special hardware limitations or requirements, other than 8bit char (signed or unsigned) and two’s complement negatives.</p>
|
||||
|
||||
<p>The limitations of using char as counters for e.g. the number of music staves are minor. 127 staves to a page is rather a lot.</p>
|
||||
|
||||
<h1>Obfuscations</h1>
|
||||
|
||||
<p>The code has no declared variables other than the command line variables. Not even pointers (we all know how messy code can get with too many pointers!). As more than one variable needs values beyond 127, parts of the command line memory are cast as integer using a macro.</p>
|
||||
|
||||
<ul>
|
||||
<li>The formatting of the code is in fact necessary, as this is the definition of the music font. It is therefore not an obfuscation.</li>
|
||||
<li>The use of only argv/argc as memory locations is a matter of reducing the memory footprint. Again, it is not an obfuscation.</li>
|
||||
<li>Calling the only remaining variables, and the two defined macros, c and C, is merely a matter of conforming to the standard WYSIWYG paradigm common in commercial notation programs (What You C is What You Get). So once again it is not an obfuscation. Anyway, it’s a C coding contest, right?</li>
|
||||
<li>Randomly using the numerical (ASCII) value for characters is compensated for by replacing some numbers by a character representation. On average, therefore, it is not an obfuscation.</li>
|
||||
<li>Randomly changing the way the elements of argv are addressed is a matter of maintaining a diversified code base. It is therefore not… Oh allright.</li>
|
||||
<li>The actual output of the music is done by one print command including a 800+ character nested conditional expression.</li>
|
||||
<li>printf is also used for its return value.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<!--
|
||||
(c) Copyright 1984-2015, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2015,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,101 @@
|
||||
# Most notable and best tool
|
||||
|
||||
Alex Deckmyn
|
||||
<alex.deckmyn@gmail.com>
|
||||
|
||||
|
||||
## Judges' comments:
|
||||
### To build:
|
||||
|
||||
make deckmyn
|
||||
|
||||
### To run:
|
||||
|
||||
# A shell interpreter with proper backtick interpolation is required
|
||||
./deckmyn "`cat deckmyn.c`" "`cat musicfile.txt`" > sheetmusic.pbm
|
||||
|
||||
### Try:
|
||||
|
||||
./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
|
||||
|
||||
### Selected Judges Remarks:
|
||||
|
||||
The C of this entry is definitely sharp. The program cleverly uses its own
|
||||
source at runtime to define the notes, time signature and accidental bitmaps.
|
||||
|
||||
In addition to sheet music, this program is also able, given the right input,
|
||||
to generate an image of a 10-pin DIP chip (a sound processor?).
|
||||
|
||||
Ironically, the way this entry is called from the command line is an abuse of C Shell.
|
||||
Please use Bourne-family shells to run this entry.
|
||||
|
||||
## Author's comments:
|
||||
|
||||
Example use
|
||||
===========
|
||||
|
||||
You need the source code and example input (either one of the example files, or manual input as below) ready. And a program capable of showing .pbm bitmap format.
|
||||
|
||||
./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
|
||||
display greensleeves.pbm
|
||||
|
||||
./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " > short_bass.pbm
|
||||
display short_bass.pbm
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
Every major C competition should have an entry capable of producing C major.
|
||||
This is a music notation program. It produces bitmaps (.pbm) of music based on ASCII input. A full manual is added as a separate file. Some musical examples are also included.
|
||||
|
||||
The program is capable of printing notes, rests, (double) bar lines and accidentals on a single melodic line (multiple staves). No chords, polyphony etc.
|
||||
|
||||
The program expects *two command line arguments*. The first is a (very long) string that contains the complete music font. Note that it should *not* be given as a file name! The default music font is encoded in the (whitespace of the) source code deckmyn.c itself. Therefore, the first argument should be "`cat deckmyn.c`".
|
||||
|
||||
The second command line argument is the music itself. This is, again, a string, not a file name. All music signs are entered as tokens of exactly 3 characters. The code is very sensitive to bad spacing! So for instance, if you use a file to write the music (e.g. example\_greensleeves), you should keep in mind that newline is also a character!
|
||||
|
||||
|
||||
Internals
|
||||
=========
|
||||
|
||||
To minimise the memory footprint, this program has *no variable declarations at all*, except for the arguments to main(). The only available memory space is from the command line arguments and count (argv and argc). Parts of argv are cast as integer when values under 0 or beyond 127 are expected.
|
||||
|
||||
The "music font" is defined by the source code itself. The first few lines are not part of the font definition, as this memory space will modified by the program. (So as required by the rules, it is only a (memory) copy of the source code that is modified.)
|
||||
|
||||
As there is no memory available, output is directly to stdout, byte by byte, from the top left to the bottom right pixel.
|
||||
|
||||
|
||||
LIMITATIONS
|
||||
===========
|
||||
|
||||
The memory locations of argv are used for various purposes. Therefore, the program name (default "deckmyn") must be *at least 4 characters long*, including possibly the path. This, along with the ending '\0', gives minimum 5 bytes of useful memory space. Otherwise, the program may attempt to write outside the string.
|
||||
|
||||
The code is quite sensitive. Errors in the input can lead to strange results. The code does not read beyond the end of the music input, but that is about the only error checking available. Any input that is not according to the rules in the MANUAL, may cause errors.
|
||||
|
||||
The program has no special hardware limitations or requirements, other than 8bit char (signed or unsigned) and two's complement negatives.
|
||||
|
||||
The limitations of using char as counters for e.g. the number of music staves are minor. 127 staves to a page is rather a lot.
|
||||
|
||||
|
||||
Obfuscations
|
||||
============
|
||||
|
||||
The code has no declared variables other than the command line variables. Not even pointers (we all know how messy code can get with too many pointers!). As more than one variable needs values beyond 127, parts of the command line memory are cast as integer using a macro.
|
||||
|
||||
- The formatting of the code is in fact necessary, as this is the definition of the music font. It is therefore not an obfuscation.
|
||||
- The use of only argv/argc as memory locations is a matter of reducing the memory footprint. Again, it is not an obfuscation.
|
||||
- Calling the only remaining variables, and the two defined macros, c and C, is merely a matter of conforming to the standard WYSIWYG paradigm common in commercial notation programs (What You C is What You Get). So once again it is not an obfuscation. Anyway, it's a C coding contest, right?
|
||||
- Randomly using the numerical (ASCII) value for characters is compensated for by replacing some numbers by a character representation. On average, therefore, it is not an obfuscation.
|
||||
- Randomly changing the way the elements of argv are addressed is a matter of maintaining a diversified code base. It is therefore not... Oh allright.
|
||||
- The actual output of the music is done by one print command including a 800+ character nested conditional expression.
|
||||
- printf is also used for its return value.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
<!--
|
||||
(c) Copyright 1984-2015, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
Reference in new issue
Block a user