Merge pull request #1642 from xexyl/maffiodo214-try-bugs

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-12-05 18:52:00 -08:00
commit a270a138ea
11 files changed
+348 -61

No files matched your search

+56 -26
View File
@@ -1,30 +1,59 @@
## To build:
This entry requires SDL to be installed. See the [faq.md](/faq.md) if you don't
know how to do this for your system.
This entry requires SDL to be installed. See [FAQ 3.8](/faq.md#faq3_8) if you
don't know how to do this for your system.
```sh
make
```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2014 maffiodo1 in bugs.md](/bugs.md#2014-maffiodo1).
## To use:
```sh
cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679
cat game.level | ./prog 320 200 800 300 128 144 game.rgba game.wav 10343679
```
The parameters to the program are:
1. Window width.
2. Window height.
3. Level width.
4. Level height.
5. Sprites image width.
6. Sprites image height.
7. Filename of the sprites image (raw RGBA image).
8. Filename of the music (WAVE 8000 Hz 8bit Mono).
9. Sky color. This number depends on the system where you run the program. See
note on macOS.
### Try:
```sh
cat giana.level | ./prog 320 200 1000 300 192 168 giana.rgba giana8.wav 5459393
./giana.sh
cat mario.level | ./prog 320 200 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet telehack.com 23
./mario.sh
```
If you end up telnetting to the server you can try:
If you end up telnetting to the server (feature of [mario.sh](mario.sh)) you can
try:
```
ls # show files including games
@@ -33,18 +62,14 @@ advent.gam # you know what this is! :-)
starwars # animated Star Wars 'film'
```
NOTE: the author stated that the sky colour is incorrect in some versions of
macOS, offering a workaround. Others tested this out in the most recent macOS
version and this does not seem to be a problem any more. As he played (and beat)
the entire series many times years ago he can confirm that the sky is more or
less correct though it's possible that because he's practically blind he might
have missed something :-) He guesses that the problem might have been the
version of `SDL1` but he does not know this either way.
If you wish to change the width and height, defaulting at 640 x 480, say to
800 x 800, try:
Others notes ironically that the author stated that in Super Mario Bros one cannot
go through walls but there are known glitches where you can in some areas (as he
recalls this also applied to the arcade version, Mario Bros, but he cannot
confirm this now) :-)
```sh
ROWS=800 COLS=800 ./mario.sh
ROWS=800 COLS=800 ./giana.sh
```
## Judges' remarks:
@@ -60,9 +85,9 @@ the code. In `vim` you can do:
```
in command mode to see this effect. You don't need to modify your `.vimrc` file!
You can also use `expand` as described below if your terminal has enough rows
and you don't want to move about in the code. The vim command should immediately
take effect.
You can also use `expand` as described below by the author if your terminal has
enough rows and you don't want to move about in the code. The vim command should
immediately take effect.
## Author's remarks:
@@ -95,7 +120,7 @@ for free!
In my two tests I tried to create one level of [Super Mario
Bros](http://en.wikipedia.org/wiki/Super_Mario_Bros.) and one of [The Great
Giana The Sisters](http://en.wikipedia.org/wiki/The_Great_Giana_Sisters).
Giana Sisters](http://en.wikipedia.org/wiki/The_Great_Giana_Sisters).
Both games are classic [platform
games](https://en.wikipedia.org/wiki/Platform_game) and both share the same
@@ -109,9 +134,10 @@ character more or different powers or abilities!
- There are walls, floors and ceilings. The character can move and jump over
these type of obstacles but cannot walk through them.
- There are enemies and; if the character collides with an enemy, the character
- There are enemies and if the character collides with an enemy, the character
dies or loses its powers.
### Running under macOS
[NOTE: this seems to no longer be the case as of 2023 and most likely much
@@ -124,11 +150,12 @@ last parameter of the program:
* GIANA LAST PARAMETER: `3243070463`
### Regarding how to compile
The code requires `SDL1`.
The build process will generate some warnings (60~ on clang) about:
The build process will generate some warnings (~60 with clang) about:
- `incompatible pointer types`: because all pointers are declared to `int` or
`char`, to save bytes.
@@ -136,6 +163,7 @@ The build process will generate some warnings (60~ on clang) about:
- `using the result of an assignment as a condition without parentheses`:
because `while(c=getchar())` is not evil.
### How it works
## Parameters
@@ -194,6 +222,7 @@ Position | Description
All the others sprites can be used as you want, depending on the game you want
to create.
## Levels
The program reads the level description from `stdin`.
@@ -259,7 +288,7 @@ Each row has six columns:
* `DESTROY` (`64`)
When the player hits the object (e.g. the classic Mario coin) the
object disappears but the engine does not counts the points, so,
object disappears but the engine does not count the points, so,
from the player point of view, this object is useless.
* `DESTROYUP` (`128`)
@@ -272,6 +301,7 @@ If `CLASSFLAGS` is `0` the object only has an aesthetic function.
The last row of the level descriptor must have all its columns set equal to
`-1`.
### Limitations
Some classical features are missing: throwing objects, shooting, multiple lives,
@@ -306,12 +336,12 @@ only demonstrates the operation of the program. From my point of view this is a
tribute to the legendary game [Super Mario
Bros](http://en.wikipedia.org/wiki/Super_Mario_Bros.)!
[The Great Giana The
[The Great Giana
Sisters](http://en.wikipedia.org/wiki/The_Great_Giana_Sisters) is the game
created by [Time Warp
Productions](https://www.ign.com/games/producer/time-warp-productions) and my
justification for the sprites for Mario are the same for this game. Long live
[The Great Giana The
[The Great Giana
Sisters](http://en.wikipedia.org/wiki/The_Great_Giana_Sisters) !! :)
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# giana.sh - demonstrate IOCCC winner 2014/maffiodo1 The Great Giana Sisters
#
# 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.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# see if the user wants to override width and height
if [[ -z "$ROWS" ]]; then
ROWS="480"
fi
if [[ -z "$COLS" ]]; then
COLS="640"
fi
# ^---------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat giana.level | ./prog "$COLS" "$ROWS" 1000 300 192 168 giana.rgba giana8.wav 5459393
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# mario.sh - demonstrate IOCCC winner 2014/maffiodo1 Super Mario Bros.
#
# 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.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# see if the user wants to override width and height
if [[ -z "$ROWS" ]]; then
ROWS="480"
fi
if [[ -z "$COLS" ]]; then
COLS="640"
fi
# ^---------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat mario.level | ./prog "$COLS" "$ROWS" 800 300 128 144 mario.rgba mario8.wav 10343679 && telnet telehack.com 23
+6 -2
View File
@@ -113,8 +113,8 @@ OBJ= ${PROG}.o
DATA= image.rgb
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -137,6 +137,10 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
# data files
#
data: ${DATA}
+47 -7
View File
@@ -4,6 +4,21 @@
make
```
There is a 121 byte version provided by the author. See [Alternate
code](#alternate-code) below.
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2014 maffiodo2 in bugs.md](/bugs.md#2014-maffiodo2).
## To use:
@@ -15,7 +30,28 @@ make
### Try:
```sh
cat image.rgb | ./prog ' .,:;!$#@'
./try.sh
```
## Alternate code:
This shorter version is provided by the author. It has a fixed ramp and so not
as fun but it's 121 bytes instead of 140.
### Alternate build:
```sh
make alt
```
### Alternate use:
```sh
cat image.rgb | ./prog.alt
```
@@ -34,14 +70,15 @@ get? And how many people will really understand the tweet?
### Remarks
This program convert an image to an ASCII ART. The program reads a raw RGB image
from **stdin** and print the ASCII ART to **stdout**.
from `stdin` and print the ASCII ART to `stdout`.
The build process will raise some warnings about:
- declaration specifier missing, defaulting to 'int'
- implicitly declaring library function
The program crash if run without parameters.
The program will crash if run without parameters.
### Screen size
@@ -60,13 +97,17 @@ Type this:
cat image.rgb | ./prog " .:;Y0"
```
You can use your own image. Convert the image to a raw RGB image, using imagemagick it's very simple:
You can use your own image. Convert the image to a raw RGB image. Using
ImageMagick it's very simple:
```sh
convert -geometry 80x source.jpg image.rgb
```
This program require one parameter, or crash. The parameter of the program is the *convertion ramp*. You can use different ramps or create your own (for ex. using some letters of your name).
This program require one parameter or it will crash. The parameter of the
program is the *conversion ramp*. You can use different ramps or create your own
(for example using some letters of your name).
These are some ramps you can try:
```sh
@@ -74,7 +115,6 @@ These are some ramps you can try:
./prog " .:;Y0"
./prog " .:-=+*#%@"
./prog " .,:!-iots&8%#@$"
./prog "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,"^`'. "
```
### 121 byte version
@@ -85,7 +125,7 @@ An alternative version of this program is only 121bytes long:
d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}
```
This alternative version have a **fixed ramp**. It's smaller but it's not so fun to use...
This alternative version has a **fixed ramp**. It's smaller but it's not so fun to use...
## Copyright and CC BY-SA 4.0 License:
+1
View File
@@ -0,0 +1 @@
d=80,e,j;g(){j+=getchar();}main(){for(;;){j=0;g();if(j<0)break;g(g());putchar(" .:#@"[j/3*5>>8]);if(!(++e%d))puts("");}}
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2014/maffiodo2
#
# 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.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ cat image.rgb | ./prog ' .,:;!$#@'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .,:;!$#@' | less -EXF
echo "$ cat image.rgb | ./prog ' .:;Y0'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog " .:;Y0" | less -EXF
echo "$ cat image.rgb | ./prog ' :1'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' :1' | less -EXF
echo "$ cat image.rgb | ./prog ' .:;Y0'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .:;Y0' | less -EXF
echo "$ cat image.rgb | ./prog ' .:-=+*#%@'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .:-=+*#%@' | less -EXF
echo "$ cat image.rgb | ./prog ' .,:!-iots&8%#@$'" 1>&2
read -r -n 1 -p "Press any key to run command (space = next page, q = quit): "
echo 1>&2
# ^-------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# shellcheck disable=SC2002
cat image.rgb | ./prog ' .,:!-iots&8%#@$' | less -EXF
+19 -26
View File
@@ -15,20 +15,7 @@ make
### Try:
```sh
make
cp -f prog morgan
./morgan clobber
ls
./morgan all install
ls
./prog love haste waste supernova
ls
make
./prog magic
ls
./try.sh
```
@@ -36,38 +23,41 @@ ls
Think of this as a Maker Faire's make. :-)
It works reasomably well. While not super ultra-featured, it does fair well with the Makefile we supplied.
Not only that, it helped uncover a bug we had in our special Makefile rules.
It works reasonably well. While not super ultra-featured, it does fair well
with the Makefile we supplied. Not only that, it helped uncover a bug we had in
our special Makefile rules.
## Author's remarks:
### Remarks
This program is a tiny `make` clone.
This program is a tiny `make(1)` clone.
It is able to parse a subset of the `make` syntax and will execute rules for
It is able to parse a subset of the `make(1)` syntax and will execute rules for
goals given in arguments if they need to (based on timestamp of dependencies
of rule targets).
## Supported features
* Variable assignments (only recursive ones). Variable references with recursion.
* Environment variables are available.
* It is possible to specify variables in command line: `name=value`.
* Variables given in command line will have precedence over variables defined
in makefile, which will have precedence over environment variables.
* If no goal given in command line, the first target defined will be used.
in Makefile, which will have precedence over environment variables.
* If no target given in command line, the first target defined will be used.
* Comments, escaped comments, escaped new lines.
It should be able to build programs of previous years with the provided `Makefile`
found in previous contest archives. Simply use this program instead of `make`.
It will recursively use itself for submake (the `MAKE=` assignment inside
It will recursively use itself for sub-make (the `MAKE=` assignment inside
`Makefile` will be ignored to continue using itself).
## Limitations / Known issues
* There is a lot of memory leak (not a single free).
* There are a lot of memory leaks (not a single free).
* The opened file is not closed.
* The input file shall be named `Makefile`.
* No diagnostic message, but the exit status is non zero to indicates failure
@@ -82,13 +72,16 @@ It will recursively use itself for submake (the `MAKE=` assignment inside
* No built-in variables (except the one from environment).
* No conditional directives.
### Compilation warnings
with gcc 4.8.2 on Linux Ubuntu 14.04 64-bit :
* prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default]
* prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare]
* prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
With gcc 4.8.2 on Linux Ubuntu 14.04 64-bit :
```
prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default]
prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare]
prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
```
## Copyright and CC BY-SA 4.0 License:
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2014/morgan
#
# 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.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ cp -f prog morgan" 1>&2
cp -f prog morgan
echo "$ ls" 1>&2
ls
read -r -n 1 -p "Press any key to run: ./morgan all install: "
echo 1>&2
./morgan all install
echo 1>&2
echo "$ ls" 1>&2
ls
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog love haste waste supernova: "
echo 1>&2
./prog love haste waste supernova
echo 1>&2
echo "$ ls" 1>&2
ls
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog magic: "
echo 1>&2
./prog magic
echo 1>&2
echo "$ ls" 1>&2
ls
+42
View File
@@ -2955,6 +2955,48 @@ it out as a known limitation it is not a bug but a feature.
# 2014
## 2014 maffiodo1
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2014/maffiodo1/prog.c](2014/maffiodo1/prog.c)
### Information: [2014/maffiodo1/README.md](2014/maffiodo1/README.md)
The author noted that in macOS the colours might be wrong. They gave a solution.
However Cody didn't see any problem with it and he beat the series many times.
Of course the game here is small and he's practically blind and it's been a
while since he last played so it might be wrong. Nevertheless the author does
give a way to reconfigure the colours.
The author noted that the character cannot go through walls and the impression
is that this is how it was believed but Cody ironically pointed out that there
are known glitches where in some places you actually could go through walls.
This might even have applied to the arcade version, Mario Bros, though that can
no longer be confirmed by Cody. The point here is that in this game you cannot
go through walls but it's not a bug.
On the other hand, the author also stated:
--
When the `Super character` becomes bigger (`ZOOM` flag), the character can
collide with blocks and get stuck inside them. This is a KNOWN BUG. When your
player become bigger, stay away from blocks!
--
but since it's documented it's considered a feature, not a bug to fix.
## 2014 maffiodo2
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2014/maffiodo2/prog.c](2014/maffiodo2/prog.c)
### Information: [2014/maffiodo2/README.md](2014/maffiodo2/README.md)
This program will very likely crash if no arg is given.
## 2014 vik
### STATUS: known bug - please help us fix
+18
View File
@@ -3715,6 +3715,24 @@ it is a file with spoilers (and too close to README.md?).
[Cody](#cody) fixed the build for this entry: it does not require
[SDL2](https://www.libsdl.org) but SDL1 so there were linking errors.
Cody also added the [mario.sh](2014/maffiodo1/mario.sh) and
[giana.sh](2014/maffiodo1/giana.sh) scripts which play, respectively, [Super
Mario Bros](http://en.wikipedia.org/wiki/Super_Mario_Bros.) and one of [The
Great Giana Sisters](http://en.wikipedia.org/wiki/The_Great_Giana_Sisters), but
which let one configure the width and height of the game.
## [2014/maffiodo2](2014/maffiodo2/prog.c) ([README.md](2014/maffiodo2/README.md]))
[Cody](#cody) added the [try.sh](2014/maffiodo2/try.sh) script and the
[alternate code](2014/maffiodo2/README.md#alternate-code) provided by the
author.
## [2014/morgan](2014/morgan/prog.c) ([README.md](2014/morgan/README.md))
[Cody](#cody) added the [try.sh](2014/morgan/try.sh) script.
## [2014/sinon](2014/sinon/prog.c) ([README.md](2014/sinon/README.md))