How much sanity checking is required for function inputs?

Christopher Reimer christopher_reimer at icloud.com
Sat Apr 23 22:03:03 EDT 2016


On 4/23/2016 2:33 PM, Matt Wheeler wrote:
> This is still backwards to me. It prevents your classes from being
> suitable for restoring a stored game state, not just custom starting
> positions (which I think is what Ethan means by custom setups).

I haven't thought that far about saving the game state. I'm under the 
impression that pickle (or something else) would save and load the 
instantiated object of each piece. If that's not the case, I'll change 
the code then.

The sanity check does have an exemption for pawn promotion, where a pawn 
reaching the other side of the board can be promoted to another piece 
(typically a queen). I played Sargon II chess on the Commodore 64 for 
five years as a teenager. The worst game I ever won was when the 
computer had nine queens on the board. I thought the computer was 
cheating outrageously but a chess rule book confirmed that promotion was 
a legit move.

https://en.wikipedia.org/wiki/Promotion_(chess)

If I need to add an exemption to custom plays, I'll add it then. Right 
now I'm cleaning up the existing code from all the bad Java habits.

Thank you,

Chris R.



More information about the Python-list mailing list