River Crossing Puzzle Generator Exercise
This repo contains a puzzle generator I created to test ChatGPT's logical reasoning skills (river_puzzle_tg.py), alongside 3 versions ChatGPT produced (which, in general, don't work).
The object was to find a formula for puzzle generation which guarantees model collapse. While I did elicit failures on many occasions with various puzzles, I was never able to find a definite formula. Sometimes ChatGPT failed on a relatively simple puzzle; sometimes it succeeded with a very complex one. Perhaps you can find a formula that works? If you do, be sure to let me know...
Usage
python3 river_puzzle_tg.py [-h] [-a MAX_ANIMALS] [-b BOAT_CAPACITY] [-B] [-c CONSTRAINT_FACTOR] [-m] [-u] [-r MAX_RETRIES] [-s SEED]
River Crossing Puzzle Generator - TG Oct 2026 - Written entirely by a human!
options:
-h, --help
show this help message and exit
-a, --max-animals MAX_ANIMALS
The number of animals to transport
-b, --boat-capacity BOAT_CAPACITY
The maximum number of animals that can be transported in the boat at one time
-B, --buster
Create a ChatGPT "busting" puzzle (one ChatGPT is likely to struggle with). Note this assumes a set of parameters, and will
override them if they are set independently
-c, --constraint-factor CONSTRAINT_FACTOR
The strictness of the rules to apply. 1 = strict as possible (can lead to a forced puzzle), 0 = least strict (puzzle may have
many solutions)
-m, --min-solutions
Also check for shorter solutions (than the original assumed solution) which obey the same rule set. Note this is a search-
type operation which may take a very long time (and consume system resources) for higher complexity puzzles, and probably
should not be used in this case.
-u, --simple-unique
Create a "simple unique" puzzle - where there is always only one possible next move until all animals are transported. This
overrides the "constraint factor" setting it to 1. Potentially useful for testing. Otherwise, not very challenging.
-r, --max-retries MAX_RETRIES
Applies when search-type operations are involved. This is the hard upper limit to the number of possible retries, above which
the job is aborted
-s, --seed SEED
The random seed to use. Stating an explicit seed is helpful for repeat generations of the same puzzle. If not specified, the
seed is taken from the clock
Also
Note that I am intending the -B ("buster") switch should provide the correct formula to guarantee ChatGPT can't solve the problem. But hats of to OpenAI in that their model really can solve some quite complex river crossing puzzles - and so far I haven't found a formula that always works. Perhaps you can?
Note I think it's likely that OpenAI put some effort solving this kind of problem specifically (since it's a common logic problem). I suspect it might fall over on a much easier puzzle, if the puzzle was something completely different to what it had come across in training.
Author
Tom Gracey
License
MIT License - use it, modify it, sell it, do whatever. Try to confound ChatGPT with it. Probably you shouldn't do that too much though, because it's likely costing OpenAI a fortune(?) and killing a small rainforest every time you do it.
Also remember: whatever happens, it's got nothing to do with me. You only have yourself to blame. :D