June 21st, 2013, 10:06 AM
I need some help for python AI. I can't understand some codes for python AI. I need to understand this code. So please help me.
if self.nature is 'AI':
return self.name+' ('+self.nature+')'+' as '+self.colour
return self.name+' as '+self.colour
In this code 'AI' is used. But I dont understand this AI. Actually this code is used for chess game. So I need to understand this code for my work. please help me.
June 22nd, 2013, 05:14 AM
That 'AI' is nothing but a normal string. If it's the word 'is' that is confusing you, then 'is' is almost as same as '==' Just the difference is the == operator tests whether the two referenced objects have the same values. The is operator tests if both names print to exact same object.
Originally Posted by bilashcse