Re:Norvig's Python programs to practice or demonstrate skills
by dfee on Monday November 27, 2017 @09:32PM
(#15793803)
Please re-read my comment. I understand what he did, but my points stand.
The name `SET` conveys little. Running the exercise in the same file is OK as it’s not in a module, but again - the work demonstrates algorithms well enough, but I can’t see this coding style as “smart” or “clean”. It’s not.
Re:Norvig's Python programs to practice or demonstrate skills
by gary_bernhardt on Monday November 27, 2017 @11:15PM
(#15794334)
Top of the file:
""" Game of Set (Peter Norvig 2010-2015) """
It's the name of the problem being solved.
Defining a function and immediately calling it prevents pollution of module scope. Without it, `photo` would be exported.
The tests are in the same file because it makes the example self-contained, I assume.
The experiments are run 100,000 times because they have a random component and this exercises the system.