[Grok-dev] Re: Me Grok Play Chess!
Philipp von Weitershausen
philipp at weitershausen.de
Sun Apr 15 11:03:49 EDT 2007
Philipp von Weitershausen wrote:
>> I am not too clear on that buildout thingie, but if you use
>> grokproject you can create a new project and then put this code into
>> the src/ dir.
>> The chess program itself is in the chessmind directory. You can run
>> its unit tests by running ./__init__.py. Add '-v' if you want to see
>> what is being tested.
> I have a few comments that are mostly motivated by aesthetics, but do
> represent some of the common patterns that we're trying to promote with
(another comment on the code)
* In Index.update(), you access request variables using
self.request.form.get(). A shortcut is to simply expect these as
parameters to udpate(), using default values to indicate the value that
the parameter should have when it's not in the request. Your update()
could look like this:
def update(promotion=False, reset=None, undo=None, redo=None,
start=None, target=None, square=None):
Then you could save some repitition in the actual method implementation.
http://worldcookery.com -- Professional Zope documentation and training
More information about the Grok-dev