This project contains a C++ program and a Python script designed to analyze the performance of a number guessing algorithm. The C++ program calculates the average number of tries it takes to guess a number using a specific strategy, and outputs the results to a file. The Python script then reads these results and generates a graphical representation of the data.
main.cpp
: The C++ program that implements the number guessing algorithm and calculates the averages.graph.py
: The Python script that reads the averages from the output file and generates a plot.averages.txt
: The output file generated by the C++ program containing the averages.
- A C++ compiler (e.g., g++, clang)
- Python 3
- Matplotlib library for Python (Install using
pip install matplotlib
)
- Compile the C++ program using a C++ compiler:
g++ main.cpp -o main
- Run the compiled program:
./main
This will generate the averages.txt
file with the average number of tries for different divisors.
- Ensure you have Python and Matplotlib installed.
- Run the script:
python graph.py
This will read the averages.txt
file and display a plot showing the relationship between the divisor and the average number of tries.
Feel free to fork this project and submit pull requests or suggest improvements by opening issues.
[Insert your preferred license here, or state if it's unlicensed]
- Your Name: Vicente Pareja
- Your Email: vicente.pareja@uc.cl
We hope this tool helps in understanding the behavior of the number guessing algorithm. For any questions or suggestions, please contact the contributors.