Copyright 2019-2022 Caleb Evans
Released under the MIT license
This project was inspired by a math problem posed to Parade magazine's Marilyn Vos Savant in November 2019:
In a contest, a friend guessed the exact number of coins in a jar: 1,692. She won all of the coins, which totaled $100.54. They consisted of pennies, nickels, dimes and quarters. How many coins of each kind were in the jar?
Source: https://parade.com/951440/marilynvossavant/can-you-solve-this-coin-riddle/
This project serves as a generalized solver program given any number of coins and any dollar amount.
virtualenv --python=python3 .virtualenv
source .virtualenv/bin/activate
pip install -r requirements.txt
python -m coinproblem -c 1692 -a 100.54
--total-coin-count
/-c
: The total number of coins (i.e. the coin count)--total-coin-amount
/-a
: the total dollar value of all coins combined (i.e. the coin amount)
The referee program accepts a variable number of executables that will be pit
against each other. The referee program must be run as a module via the
python -m
command.
Please refer to the Player Program Specification to learn how to write your own player programs.
python -m coinproblem.referee ./coinproblem/my-player.py
--timeout
/-t
(default: 10): The number of seconds each player will run before timing out--min-count
/--min
(default: 0): The minimum number of coins per coin type to be generated--max-count
/--max
(default: 100): The maximum number of coins per coin type to be generated
nose2 --quiet
To add additional test cases, please append an array of [penny, nickel, dime, quarter]
counts to the JSON array in test_cases.json
.