Different Results between main.py and test.module ?- Machine Learning with Python Projects - Rock Paper Scissors

Does anyone have a different outcome for main.py and test.module?

Final results: {‘p1’: 400, ‘p2’: 200, ‘tie’: 400}
Player 1 win rate: 66.66666666666666%
Final results: {‘p1’: 995, ‘p2’: 1, ‘tie’: 4}
Player 1 win rate: 99.8995983935743%
Final results: {‘p1’: 995, ‘p2’: 3, ‘tie’: 2}
Player 1 win rate: 99.6993987975952%
Final results: {‘p1’: 1000, ‘p2’: 0, ‘tie’: 0}
Player 1 win rate: 100.0%

Testing game against abbey…
Final results: {‘p1’: 399, ‘p2’: 401, ‘tie’: 200}
Player 1 win rate: 49.875%
FTesting game against kris…
Final results: {‘p1’: 995, ‘p2’: 1, ‘tie’: 4}
Player 1 win rate: 99.8995983935743%
.Testing game against mrugesh…
Final results: {‘p1’: 400, ‘p2’: 398, ‘tie’: 202}
Player 1 win rate: 50.125313283208015%
FTesting game against quincy…
Final results: {‘p1’: 1000, ‘p2’: 0, ‘tie’: 0}
Player 1 win rate: 100.0%

So, am I doing it right or wrong? I really don’t get why there is a difference in results even though the play function in both is the same.

If you run either main.py or test.module repearedly, you may find the outcomes appear different each time. That means whether your algorithm works or not depends on chance quite heavily.

I have the same issue right now.
I tested everything in test.module and I had the following results:

test_module.py::UnitTests::test_player_vs_abbey PASSED                   [ 25%]Testing game against abbey...
Final results: {'p1': 460, 'p2': 254, 'tie': 286}
Player 1 win rate: 64.42577030812325%

test_module.py::UnitTests::test_player_vs_kris PASSED                    [ 50%]Testing game against kris...
Final results: {'p1': 499, 'p2': 0, 'tie': 501}
Player 1 win rate: 100.0%

test_module.py::UnitTests::test_player_vs_mrugesh PASSED                 [ 75%]Testing game against mrugesh...
Final results: {'p1': 622, 'p2': 252, 'tie': 126}
Player 1 win rate: 71.16704805491992%

test_module.py::UnitTests::test_player_vs_quincy PASSED                  [100%]Testing game against quincy...
Final results: {'p1': 601, 'p2': 399, 'tie': 0}
Player 1 win rate: 60.099999999999994%

However, when I try to run main I have 1 fail with abbey and don’t understand how it even happened

Testing game against abbey...
Final results: {'p1': 333, 'p2': 334, 'tie': 333}
Player 1 win rate: 49.92503748125937%
Testing game against kris...
Final results: {'p1': 499, 'p2': 0, 'tie': 501}
Player 1 win rate: 100.0%
Testing game against mrugesh...
Final results: {'p1': 651, 'p2': 192, 'tie': 157}
Player 1 win rate: 77.22419928825623%
Testing game against quincy...
Final results: {'p1': 601, 'p2': 399, 'tie': 0}
Player 1 win rate: 60.099999999999994%

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.