linqs / pacman

Undergraduate AI assignments disguised as Pac-Man!
https://linqs.github.io/pacman/
Other
11 stars 44 forks source link

Feature extractor attempting to get the length of None #63

Closed JEF1056 closed 2 months ago

JEF1056 commented 2 years ago

Error is on this line https://github.com/linqs/pacman/blob/3cd55efc788ce6d9491c24850c0a772ad3759ad7/pacai/core/featureExtractors.py#L62 searchbfs(prob) may occasionally return None, which does not have a length. I do not have full debug logs as I have fixed it myeslf on my own repo by changing the line to dist = len(search.bfs(prob)) if search.bfs(prob) else 0 Feel free to use my fix or whatever equivalent you feel makes the most sense for this codebase

eriq-augustine commented 2 years ago

I believe search.bfs is defined to always return a list: https://github.com/linqs/pacman/blob/3cd55efc788ce6d9491c24850c0a772ad3759ad7/pacai/student/search.py#L9

So I think returning a None (vs an empty list) would indicate an incorrect student implementation.

eriq-augustine commented 2 months ago

If I am reading this correctly, the current behavior is correct. We can reopen if I am mistaken.