Files
ioccc/2004/burley
Landon Curt Noll f07fec3a98 fix tar-year.sh, removed use of .tar.tstamp files
Eliminated the need for the `.tar.tstamp` files.  It became intractable
to produce a tarball that was byte-for-byte identical to a tarball
on another platform.  We further simplified the process used by the
`bin/tar-year.sh` tool to no longer need `.tar.tstamp` files.
Removed `.tar.tstamp` files and updated the manifest.
Sorry (tm Canada 🇨🇦) for the "flip-flop".

The `bin/tar-year.sh` tool now uses a similar algorithm to how
`bin/tar-entry.sh` determines if a compressed tarball needs to be
rebuilt.

Changed `bin/tar-entry.sh` VERSION from "1.3.3 2024-03-27"
to "1.3.4 2024-03-27".

Changed `bin/tar-year.sh` VERSION from "1.1.3 2024-03-27"
to "1.2 2024-03-27".

Performed `make www` and `make form_entry_tarball`
and `make form_year_tarball` to complete the above
actions and test these changes under macOS.

TODO: Test the `bin/tar-year.sh` tool under Linux.

TODO: Address issues with building the top level `ioccc.tar.bz2`
      and the `bin/tar-all.sh` tool and the `make form_all_tarball` rule.

NOTE: The `bin/tar-all.sh` tool and the `make form_all_tarball` rule
and the `make tar` should **NOT** be used at this time.
2024-03-27 16:49:11 -07:00
..
…
2024-03-20 00:19:52 -07:00

To build:

make

NOTE: We FORCE the use of -O0 even if someone overrides it because this entry will not work with it enabled.

To use:

./burley

NOTE: you need to input a number first. See judges' remarks below for information on how to play.

Judges' remarks:

This is a draw poker program. You start with $100. Input alternates between your bet and which cards to keep. Example:

5		<== you enter a bet of $5 (defaults to $1)
J Q J 9 5	<== your hand is Jack of Clubs, Queen of Hearts,
C H D S C	    Jack of Diamonds, 9 of Spades, 5 of Clubs
123		<== you enter which cards you want to keep
		    (enter 0 to 5 digits between 1 and 5)
J Q J J Q	<== your new hand is Jack of Clubs, Queen of Hearts,
C H D S C	    Jack of Diamonds, Jack of Spaces, Queen of clubs
$145 (45)	<== Your new balance is now $145.  You had a Full House
		    so your payoff is 9 times your bet == 45

The payout is according to "Vegas rules":

Straight Flush     50 times your bet
Four of a Kind     25 times your bet
Full House          9 times your bet
Flush               6 times your bet
Straight            4 times your bet
3 of a Kind         3 times your bet
2 Pair              2 times your bet
Jacks or Better     1 times your bet

The program allows you to go into debt. However I'm sure you would never control-C to kill the program just because you got behind, right? On the other hand the program never willingly exits, so you have to leave even when you are ahead. :-)

Can you figure out a winning betting "strategy"? Then can you modify the program so this "strategy" no longer works?

Notice the clever use of setjmp(3) and longjmp(3) calls. Can you keep track of what state is being saved and restored?

NOTE: the author talks about how it is a single statement. This might not be strictly true in 2023 for the fixes for it to work so you can look at the original file burley.orig.c to see what is meant.

Author's remarks:

This program plays draw poker. What is unusual about it is that it is written as a single statement -- count the semicolons! (OK, there are really three statements if you count the variable declarations.) To keep things simple, I have avoided the C preprocessor and tricky statements such as if, for, do, while, switch, and goto.