This program is written to solve the Numbers Evaille problem:
Given a pack of cards with unique numbers and a required goal card from the pack. The cards are categorized into ranks. Find 4 cards of whose ranks differ from each other, such that the sum of the 4 cards is equal to the goal card's number.
- Solving for extra cards is currently unavailable. You have to find a way to format them in the input file.
- The input file can only contain a rank per card. For cards with alternative ranks, you need to create a new input file.
The project folder contains these files:
- card.py: Python file defining class Card
- deck.py: Python file defining class Deck
- algorithm.py: Python file defining algorithm to find all the combinations to make the total but haven't checked their ranks yet
- solution.py: Python solution file
- input.txt: Sample input file, currently only contains 107 first cards and their primary ranks
- output.txt: Sample output file for Card number 86
- README.md: Instruction file
- .gitignore: Git's config file to ignore unnecessary files while releasing the project
- You need to install Python version 3.x on your machine, or have a python compiler in your IDE (Visual Studio, Pycharm,...).
- In your terminal, clone this repo:
or:
git clone https://github.com/lonhattan007/numbers_evaille.git
The second method requires an SSH key every time you pull from or push to the repo.git clone [email protected]:lonhattan007/numbers_evaille.git
- Open your terminal. On Windows, press
Ctrl + R
, then typecmd
and pressEnter
. - Move into this folder:
cd numbers_evaille
- In your terminal, move into this folder and run the following command:
- Windows:
python solution.py your_input_file_name.txt your_output_file_name.txt
- Linux or Mac:
python3 solution.py your_input_file_name.txt your_output_file_name.txt
- For example:
python solution.py input_base_107.txt output_86.txt
- Or you can run the program in your IDE, make sure to config your input and output files' names as arguments.
- The program will rewrite the file
output.txt