add freqAnalyzer strategy
The test failures don't seem to be related to your contribution.
For example:
Expected:
Axelrod game: (R,P,S,T) = (3, 1, 0, 5)
Got:
Axelrod game: (R,P,S,T) = (np.int64(3), np.int64(1), np.int64(0), np.int64(5))
I'd still like to investigate what is happening here though. I wonder if this could be related to numpy's 2.0.0 release.
Here's what tox has installed (indeed numpy==2.0.0).
py311: attrs==23.2.0,Axelrod @ file:///home/runner/work/Axelrod/Axelrod/.tox/.tmp/package/1/axelrod-4.14.0.tar.gz#sha256=4b519abc1589884bdc18d5eaf0f4240bf8d1a3681b080e92b0df52dd62ef4a11,black==24.4.2,click==8.1.7,cloudpickle==3.0.0,contourpy==1.2.1,coverage==7.5.4,cycler==0.12.1,dask==2024.7.0,dask-expr==1.1.7,fonttools==4.53.1,fsspec==2024.6.1,hypothesis==6.105.0,importlib_metadata==8.0.0,iniconfig==2.0.0,isort==5.13.2,kiwisolver==1.4.5,locket==1.0.0,matplotlib==3.9.1,mypy-extensions==1.0.0,numpy==2.0.0,packaging==24.1,pandas==2.2.2,partd==1.4.2,pathspec==0.12.1,pillow==10.4.0,pip==24.1,platformdirs==4.2.2,pluggy==1.5.0,pyarrow==16.1.0,pyparsing==3.1.2,pytest==8.2.2,pytest-cov==5.0.0,pytest-randomly==3.15.0,pytest-sugar==1.0.0,python-dateutil==2.9.0.post0,pytz==2024.1,PyYAML==6.0.1,scipy==1.14.0,setuptools==70.1.0,six==1.16.0,sortedcontainers==2.4.0,termcolor==2.4.0,toolz==0.12.1,tqdm==4.66.4,tzdata==2024.1,wheel==0.43.0,zipp==3.19.2
The test failures don't seem to be related to your contribution.
For example:
Expected: Axelrod game: (R,P,S,T) = (3, 1, 0, 5) Got: Axelrod game: (R,P,S,T) = (np.int64(3), np.int64(1), np.int64(0), np.int64(5))I'd still like to investigate what is happening here though. I wonder if this could be related to numpy's
2.0.0release.Here's what
toxhas installed (indeednumpy==2.0.0).py311: attrs==23.2.0,Axelrod @ file:///home/runner/work/Axelrod/Axelrod/.tox/.tmp/package/1/axelrod-4.14.0.tar.gz#sha256=4b519abc1589884bdc18d5eaf0f4240bf8d1a3681b080e92b0df52dd62ef4a11,black==24.4.2,click==8.1.7,cloudpickle==3.0.0,contourpy==1.2.1,coverage==7.5.4,cycler==0.12.1,dask==2024.7.0,dask-expr==1.1.7,fonttools==4.53.1,fsspec==2024.6.1,hypothesis==6.105.0,importlib_metadata==8.0.0,iniconfig==2.0.0,isort==5.13.2,kiwisolver==1.4.5,locket==1.0.0,matplotlib==3.9.1,mypy-extensions==1.0.0,numpy==2.0.0,packaging==24.1,pandas==2.2.2,partd==1.4.2,pathspec==0.12.1,pillow==10.4.0,pip==24.1,platformdirs==4.2.2,pluggy==1.5.0,pyarrow==16.1.0,pyparsing==3.1.2,pytest==8.2.2,pytest-cov==5.0.0,pytest-randomly==3.15.0,pytest-sugar==1.0.0,python-dateutil==2.9.0.post0,pytz==2024.1,PyYAML==6.0.1,scipy==1.14.0,setuptools==70.1.0,six==1.16.0,sortedcontainers==2.4.0,termcolor==2.4.0,toolz==0.12.1,tqdm==4.66.4,tzdata==2024.1,wheel==0.43.0,zipp==3.19.2
Yep, looks like numpy installation is the issue. I'm seeing this error in my local jupyter notebook I'm using for testing:
File ~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:49
[46](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:46) from numpy.linalg import inv
[48](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:48) from matplotlib import _api
---> [49](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:49) from matplotlib._path import (
[50](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:50) affine_transform, count_bboxes_overlapping_bbox, update_path_extents)
[51](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:51) from .path import Path
[53](https://file+.vscode-resource.vscode-cdn.net/Users/ianmiller/sources/projects/Axelrod/~/Library/Python/3.9/lib/python/site-packages/matplotlib/transforms.py:53) DEBUG = False
ImportError: numpy.core.multiarray failed to import
New numpy release is incompatible with older version of matplotlib and for some reason, pip's dependency resolver wasn't working properly. I was able to resolve locally by upgrading pip, numpy, and matplotlib.
A few tests are failing:
- one in the docs that counts total strategies of various types
- one involving the name / repr of your strategy
- lines 89 and 93 are uncovered
Hello @miller-ian 👋🏻
The tests are failing at your test_strategy_random function. This is because you are expecting your strategy to defect on the 31st round, but it cooperates.
The opponent hasn't defected yet, so in your player's mind, there has only been cooperation. Therefore, it will keep cooperating. Actually your opponent based on the opponent_actions is set to defect on the 32 round 😄
E AssertionError: Tuples differ: (30, C) != (30, D)
E
E First differing element 1:
E C
E D
E
E - (30, C)
E ? ^
E
E + (30, D)
E ? ^
Hello @miller-ian 👋🏻
The tests are failing at your
test_strategy_randomfunction. This is because you are expecting your strategy to defect on the 31st round, but it cooperates.The opponent hasn't defected yet, so in your player's mind, there has only been cooperation. Therefore, it will keep cooperating. Actually your opponent based on the
opponent_actionsis set to defect on the 32 round 😄E AssertionError: Tuples differ: (30, C) != (30, D) E E First differing element 1: E C E D E E - (30, C) E ? ^ E E + (30, D) E ? ^
yep was a bit confused about the format of the test inputs but should be working now
@drvinceknight @Nikoleta-v3 PTAL