예제 #1
0
파일: sgf.py 프로젝트: wzhliang/weiqi
	def presentable(self):
		"""a presentable node is something with
			- stones
			- move
			- comment
			- or marks"""
		if util.is_stone(self.name) or util.is_move(self.name):
			return True
		for e in self.extra:
			if util.is_extra(e):
				return True
		return False
예제 #2
0
파일: sgf.py 프로젝트: wzhliang/weiqi
	def build_tree(self):
		while True:
			try:
				current = self.sgf.next_token()

				if not type(current) is str:
					continue
				if util.is_move(current):
					self.on_move(current)
				elif util.is_stone(current):
					self.on_stone(current)
				elif util.is_meta(current):
					self.on_meta(current)
				elif util.is_extra(current):
					self.on_extra(current)
				elif util.is_branch(current):
					self.on_branch(current)
				elif util.is_node(current):
					self.on_node(current)
				else:
					pass
			except IndexError:
				break
		self.reset()