当前位置: 首页>>代码示例>>Python>>正文


Python tree.node函数代码示例

本文整理汇总了Python中tree.node函数的典型用法代码示例。如果您正苦于以下问题:Python node函数的具体用法?Python node怎么用?Python node使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了node函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: splitBDD

def splitBDD(BDD,c1):
	if len(BDD.data) > c1-1:
		#print type(BDD),type(BDD.cutval),type(BDD.dimCutVal),type(BDD.data),type(BDD.n1),type(BDD.n2),type(BDD.LE),type(BDD.LEM)################
		cutVals = C2_criterion(BDD)
		BDD.n1 = tree.node(-1,-1,[],None,None,[],[])
		BDD.n2 = tree.node(-1,-1,[],None,None,[],[])
		for x in range(0,c1-1):
			if(BDD.data[x][cutVals[1]] <= cutVals[0]):
				BDD.n1.data.append(BDD.data[x])
			else:
				BDD.n2.data.append(BDD.data[x])
				pass
			pass
		BDD.cutval = cutVals[0]
		BDD.dimCutVal = cutVals[1]

		BDD.n1.LE = copy(BDD.LE)
		BDD.n1.LEM = copy(BDD.LEM)
		BDD.n2.LE = copy(BDD.LE)
		BDD.n2.LEM = copy(BDD.LEM)

		#supp de DATA LE et LEM du pere
		BDD.LE = []
		BDD.LEM = []
		BDD.data = []
	else:
		pass
开发者ID:ArtemisMucaj,项目名称:intelligent-adaptive-curiosity,代码行数:27,代码来源:utilities.py

示例2: getMove

def getMove(board, roll):

    validMoves = moveGen.getMoves(board, roll, 1)
    treeRoots = []
    #print validMoves
    for validMove in validMoves:
        root = tree.node()
        root.name = str(validMove)
        root.move = validMove
        newBoard = move(board, validMove[0][0], validMove[0][1], 1)
        newBoard = move(newBoard, validMove[1][0], validMove[1][1], 1)
        root.board = newBoard
        root.roll = roll
        treeRoots.append(root)

# What complete is essentaily the first max level
# So min first then max
# Each level should then consist of a call to the min max function
# Which will min then max
    highest = tree.node()
    for root in treeRoots:
        minMax(root)
        #print root.score
        #print root.name
        if root.score > highest.score:
            highest = root
    return highest.move
开发者ID:absolutezer093,项目名称:backgammon,代码行数:27,代码来源:ai.py

示例3: ProcName

def ProcName(father):
	global lookahead, token_list, node

	PROCNAME = node()
	nt_init(father, PROCNAME, "ProcName", [])

	if match("id"):
		T_ID = node()
		t_init(PROCNAME, T_ID, lookahead[1], [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例4: Top

def Top(father):
	global lookahead, token_list, node

	TOP = node()
	nt_init(father, TOP, "Top", [])

	if match("intc"):
		T_INTC = node()
		t_init(TOP, T_INTC, lookahead[1], [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例5: Low

def Low(father):
	global lookahead, token_list, node

	LOW = node()
	nt_init(father, LOW, "Low", [])

	if match("intc"):
		T_INTC = node()
		t_init(LOW, T_INTC, lookahead[1], [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例6: Invar

def Invar(father):
	global lookahead, token_list, node

	INVAR = node()
	nt_init(father, INVAR, "Invar", [])

	if match("id"):
		T_ID = node()
		t_init(INVAR, T_ID, lookahead[1], [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例7: TypeId

def TypeId(father):
	global lookahead, token_list, node

	TYPEID = node()
	nt_init(father, TYPEID, "TypeId", [])

	if match("id"):
		T_ID = node()
		t_init(TYPEID, T_ID, lookahead[1], [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例8: ReturnStm

def ReturnStm(father):
	global lookahead, token_list, node

	RETURNSTM = node()
	nt_init(father, RETURNSTM, "ReturnStm", [])

	if match("return"):
		T_RETURN = node()
		t_init(RETURNSTM, T_RETURN, "return", [])
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:9,代码来源:r_d_p.py

示例9: IdList

def IdList(father):
	global lookahead, token_list, node

	IDLIST = node()
	nt_init(father, IDLIST, "IdList", [])

	if match("id"):
		T_ID = node()
		t_init(IDLIST, T_ID, lookahead[1], [])
	IdMore(IDLIST)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例10: ProgramHead

def ProgramHead(father):
	global lookahead, token_list, node

	PROGRAMHEAD = node()
	nt_init(father, PROGRAMHEAD, "ProgramHead", [])

	if match("program"):
		T_PROGRAM = node()
		t_init(PROGRAMHEAD, T_PROGRAM, "program", [])
	ProgramName(PROGRAMHEAD)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例11: VarDec

def VarDec(father):
	global lookahead, token_list, node

	VARDEC = node()
	nt_init(father, VARDEC, "VarDec", [])

	if match("var"):
		T_VAR = node()
		t_init(VARDEC, T_VAR, "var", [])
	VarDecList(VARDEC)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例12: VarIdList

def VarIdList(father):
	global lookahead, token_list, node

	VARIDLIST = node()
	nt_init(father, VARIDLIST, "VarIdList", [])

	if match("id"):
		T_ID = node()
		t_init(VARIDLIST, T_ID, lookahead[1], [])
	VarIdMore(VARIDLIST)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例13: Variable

def Variable(father):
	global lookahead, token_list, node

	VARIABLE = node()
	nt_init(father, VARIABLE, "Variable", [])

	if match("id"):
		T_ID = node()
		t_init(VARIABLE, T_ID, lookahead[1], [])
	VariMore(VARIABLE)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例14: FieldVar

def FieldVar(father):
	global lookahead, token_list, node

	FIELDVAR = node()
	nt_init(father, FIELDVAR, "FieldVar", [])

	if match("id"):
		T_ID = node()
		t_init(FIELDVAR, T_ID, lookahead[1], [])
	FieldVarMore(FIELDVAR)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py

示例15: FormList

def FormList(father):
	global lookahead, token_list, node

	FORMLIST = node()
	nt_init(father, FORMLIST, "FormList", [])

	if match("id"):
		T_ID = node()
		t_init(FORMLIST, T_ID, lookahead[1], [])
	FidMore(FORMLIST)
开发者ID:YoungLeeNENU,项目名称:SNL-compiler-frontend,代码行数:10,代码来源:r_d_p.py


注:本文中的tree.node函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。