linqs / pacman

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

raiseNotDefined() Should Throw, Not Exit #27

Closed eriq-augustine closed 5 years ago

eriq-augustine commented 5 years ago

raiseNotDefined() should throw an exception, not just exit (like a jerk). Also, we want to limit the use of this as much as we can. Maybe we can just throw on the spot instead.

tsalh commented 5 years ago

If I'm not mistaken, does this just involve changing the function's code to simply: raise Exception("Method not implemented: %s" % inspect.stack()[1][3])?

What should we be doing to limit the use of this function? The only places the function is called is in the student directory, where methods have yet to be implemented.

eriq-augustine commented 5 years ago

Close, I don't want to inspect the stack. We can just throw a NotImplementedError directly.

To limit the use, we change the student code. Do we need it in all places? If it is just a few places, can we just throw in those places instead of calling another method? Should we just return a default value instead?

tsalh commented 5 years ago

I think for some functions it's necessary such as the DFS, BFS, UCS, and A*. But there are a few functions such as a game state evaluation function or heuristic methods should just return default values.

eriq-augustine commented 5 years ago

Complete in e9da7356d64eb7adba08967284b7e49a6873cfdf.