https://github.com/caleb531/coin-problem

A generalized solver program for a coin-based math puzzle from Parade magazine

https://github.com/caleb531/coin-problem

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.4%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

A generalized solver program for a coin-based math puzzle from Parade magazine

Basic Info
  • Host: GitHub
  • Owner: caleb531
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 62.5 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 6 years ago · Last pushed 12 months ago
Metadata Files
Readme License

README.md

Coin Problem

Copyright 2019-2022 Caleb Evans
Released under the MIT license

Inspiration

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.

Usage

Set up virtualenv

sh virtualenv --python=python3 .virtualenv source .virtualenv/bin/activate pip install -r requirements.txt

Run solver program

sh python -m coinproblem -c 1692 -a 100.54

Options

  • --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)

Run duel program

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.

sh python -m coinproblem.referee ./coinproblem/my-player.py

Options

  • --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

Run tests

sh 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.

Owner

  • Name: Caleb Evans
  • Login: caleb531
  • Kind: user
  • Location: Carlsbad, CA

Hi, I'm Caleb, a web developer who lives for Christ by building enjoyable apps and useful tools. I hope you are blessed by what I've made!

GitHub Events

Total
  • Push event: 3
Last Year
  • Push event: 3

Dependencies

requirements.txt pypi
  • coverage ==6.5.0
  • flake8 ==5.0.4
  • mccabe ==0.7.0
  • nose2 ==0.12.0
  • pexpect ==4.7.0
  • ptyprocess ==0.6.0
  • pycodestyle ==2.9.1
  • pyflakes ==2.5.0