Exemple #1
0
func (gam *GameTree) DoAW(p ah.NodeLoc, doPlay bool) (err ah.ErrorList) {
	movType := ah.Unocc
	gam.aW = append(gam.aW, p)
	bp := &gam.Graphs[ah.PointLevel].Nodes[p]
	cur := bp.GetNodeLowState()
	if ah.IsOccupied(ah.PointStatus(cur)) {
		// TODO: check for black and add AW_W?
		movType = ah.AW_B
	} else {
		movType = ah.AW_U
	}
	if doPlay {
		gam.ChangeNodeState(ah.PointLevel, p, ah.NodeStatus(ah.White), true)
	}
	_ = gam.AddMove(p, movType, 0, ah.NilNodeLoc)
	if doPlay {
		gam.EachAdjNode(ah.PointLevel, p,
			func(adjNl ah.NodeLoc) {
				newSt := gam.Graphs[ah.PointLevel].CompHigh(&(gam.AbstHier), ah.PointLevel, adjNl, uint16(ah.Unocc))
				gam.ChangeNodeState(ah.PointLevel, adjNl, ah.NodeStatus(newSt), true)
			})
	}
	return err
}
Exemple #2
0
func (gam *GameTree) DoAE(p ah.NodeLoc, doPlay bool) (err ah.ErrorList) {
	movType := ah.Unocc
	//	gam.aE = append(gam.aE, p)
	bp := &gam.Graphs[ah.PointLevel].Nodes[p]
	cur := bp.GetNodeLowState()
	if ah.PointStatus(cur) == ah.Black {
		movType = ah.AE_B
	} else {
		// TODO: check for white and add AE_E?
		movType = ah.AE_W
	}
	if doPlay {
		newSt := gam.Graphs[ah.PointLevel].CompHigh(&(gam.AbstHier), ah.PointLevel, p, uint16(ah.Unocc))
		gam.ChangeNodeState(ah.PointLevel, p, ah.NodeStatus(newSt), true)
	}
	_ = gam.AddMove(p, movType, 0, ah.NilNodeLoc)
	return err
}