carykh / PrisonersDilemmaTournament

Watch This Place's awesome video about iterated Prisoner's Dilemma for context! https://www.youtube.com/watch?v=BOvAbjfJ0x0
MIT License
205 stars 160 forks source link

Having trouble with folders #71

Closed y-arjun-y closed 3 years ago

y-arjun-y commented 3 years ago

Hello, I cloned the repository into VSCode, however, I cannot open the strategies folder nor the result.txt file, any help?

image

GoldenWither commented 3 years ago

Try adding os.chdir(os.path.dirname(os.path.abspath(__file__))) after all the imports (line 6) in "prisonersDilemna.py". This changes the working directory to the path the script was ran in.

y-arjun-y commented 3 years ago

Hello, it seems like the import in line 6 is now working, but now, I'm getting this error:

Traceback (most recent call last): File "/Users/arjunyadav/Desktop/PrisonersDilemmaTournament/code/prisonersDilemma.py", line 121, in runFullPairingTournament(STRATEGY_FOLDER, RESULTS_FILE) File "/Users/arjunyadav/Desktop/PrisonersDilemmaTournament/code/prisonersDilemma.py", line 85, in runFullPairingTournament print("Starting tournament, reading files from "+inFolder) TypeError: can only concatenate str (not "NoneType") to str

image

y-arjun-y commented 3 years ago

Also, if I comment that line, I get a warning saying:

RuntimeWarning: invalid value encountered in double_scalars scorePer = score/(len(STRATEGY_LIST)-1)

So, the result.txt ends up like:

TOTAL SCORES

1: prisonersDilemma: 0.000 (nan average)

y-arjun-y commented 3 years ago

Never mind, I got it to work, thank you for the help!

nobody5050 commented 3 years ago

Good luck on your strategy!