Exemplo n.º 1
0
            def has_attack(val):
                if is_int(val):
                    return False

                #print >>sys.stderr, val.__class__
                if val.__class__ == Attack:
                    return True
                
                for i in val.args:
                    if not is_int(i):
                        x = has_attack(i)
                        if x:
                            return x

                return False
Exemplo n.º 2
0
	def _num(self,n):
		log('num s%d %d' % (self, n))
		if g.eval:
			if g.b.prop[self].value==I(g.b):
				arr=buildno(n)
				self.right(arr[-1])
				for mem in arr[:-1][::-1]:
					self.left(mem)
			elif is_int(g.b.prop[self].value):
				reflen=len(buildno(n))+1
				if (n==0) and (g.b.prop[self].value==0):
					return
				elif n<g.b.prop[self].value:
					self.left('put')
					arr=buildno(n)
					self.right(arr[-1])
					for mem in arr[:-1][::-1]:
						self.left(mem)
				elif g.b.prop[self].value==n:
					return
				else:
					reflen=len(buildno(n))+1
					newarr=buildno(n,g.b.prop[self].value)
					if g.b.prop[self].value==0:
						newarr=newarr[:-1]
					if len(newarr)>reflen:
						self.left('put')
						arr=buildno(n)
						self.right(arr[-1])
						for mem in arr[:-1][::-1]:
							self.left(mem)
					else:
						for mem in newarr[::-1]:
							self.left(mem)
			else:
				self.left('put')
				arr=buildno(n)
				self.right(arr[-1])
				for mem in arr[:-1][::-1]:
					self.left(mem)
		else:
			arr=buildno(n)
			self.right(arr[-1])
			for mem in arr[:-1][::-1]:
				self.left(mem)