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


Golang common.Province类代码示例

本文整理汇总了Golang中github.com/zond/godip/common.Province的典型用法代码示例。如果您正苦于以下问题:Golang Province类的具体用法?Golang Province怎么用?Golang Province使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Coasts

func (self *Graph) Coasts(prov common.Province) (result []common.Province) {
	if node, ok := self.nodes[prov.Super()]; ok {
		for _, sub := range node.subs {
			result = append(result, sub.getName())
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:8,代码来源:graph.go

示例2: edges

func (self *Graph) edges(n common.Province) (result map[common.Province]*edge) {
	p, c := n.Split()
	if node, ok := self.nodes[p]; ok {
		if sub, ok := node.subs[c]; ok {
			result = sub.edges
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:9,代码来源:graph.go

示例3: Flags

func (self *Graph) Flags(n common.Province) (result map[common.Flag]bool) {
	p, c := n.Split()
	if node, ok := self.nodes[p]; ok {
		if sub, ok := node.subs[c]; ok {
			result = sub.flags
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:9,代码来源:graph.go

示例4: Has

func (self *Graph) Has(n common.Province) (result bool) {
	p, c := n.Split()
	if node, ok := self.nodes[p]; ok {
		if _, ok := node.subs[c]; ok {
			result = true
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:9,代码来源:graph.go

示例5: Prov

func (self *Graph) Prov(n common.Province) *subNode {
	p, c := n.Split()
	if self.nodes[p] == nil {
		self.nodes[p] = &node{
			name:  p,
			subs:  make(map[common.Province]*subNode),
			graph: self,
		}
	}
	return self.nodes[p].sub(c)
}
开发者ID:arlm,项目名称:godip,代码行数:11,代码来源:graph.go

示例6: AllFlags

func (self *Graph) AllFlags(n common.Province) (result map[common.Flag]bool) {
	result = map[common.Flag]bool{}
	p, _ := n.Split()
	if node, ok := self.nodes[p]; ok {
		for _, sub := range node.subs {
			for flag, _ := range sub.flags {
				result[flag] = true
			}
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:12,代码来源:graph.go

示例7: AddBounce

func (self *State) AddBounce(src, dst common.Province) {
	if existing, ok := self.bounces[dst.Super()]; ok {
		existing[src.Super()] = true
	} else {
		self.bounces[dst.Super()] = map[common.Province]bool{
			src.Super(): true,
		}
	}
}
开发者ID:arlm,项目名称:godip,代码行数:9,代码来源:state.go

示例8: Order

func (self *State) Order(prov common.Province) (o common.Order, p common.Province, ok bool) {
	if o, ok = self.orders[prov]; ok {
		p = prov
		return
	}
	sup, _ := prov.Split()
	if o, ok = self.orders[sup]; ok {
		p = sup
		return
	}
	for _, name := range self.graph.Coasts(prov) {
		if o, ok = self.orders[name]; ok {
			p = name
			return
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:18,代码来源:state.go

示例9: SupplyCenter

func (self *State) SupplyCenter(prov common.Province) (n common.Nation, p common.Province, ok bool) {
	if n, ok = self.supplyCenters[prov]; ok {
		p = prov
		return
	}
	sup, _ := prov.Split()
	if n, ok = self.supplyCenters[sup]; ok {
		p = sup
		return
	}
	for _, name := range self.graph.Coasts(prov) {
		if n, ok = self.supplyCenters[name]; ok {
			p = name
			return
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:18,代码来源:state.go

示例10: Unit

func (self *State) Unit(prov common.Province) (u common.Unit, p common.Province, ok bool) {
	if u, ok = self.units[prov]; ok {
		p = prov
		return
	}
	sup, _ := prov.Split()
	if u, ok = self.units[sup]; ok {
		p = sup
		return
	}
	for _, name := range self.graph.Coasts(prov) {
		if u, ok = self.units[name]; ok {
			p = name
			return
		}
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:18,代码来源:state.go

示例11: Bounce

func (self *State) Bounce(src, dst common.Province) bool {
	if sources, ok := self.bounces[dst.Super()]; ok {
		if dislodger, ok := self.dislodgers[dst.Super()]; ok {
			if len(sources) == 1 && sources[dislodger.Super()] {
				return false
			}
		}
		return true
	}
	if self.dislodgers[dst.Super()] == src.Super() {
		return true
	}
	return false
}
开发者ID:arlm,项目名称:godip,代码行数:14,代码来源:state.go

示例12: SC

func (self *Graph) SC(n common.Province) (result *common.Nation) {
	if node, ok := self.nodes[n.Super()]; ok {
		result = node.sc
	}
	return
}
开发者ID:arlm,项目名称:godip,代码行数:6,代码来源:graph.go

示例13: SetDislodger

func (self *State) SetDislodger(attacker, victim common.Province) {
	self.dislodgers[attacker.Super()] = victim.Super()
}
开发者ID:arlm,项目名称:godip,代码行数:3,代码来源:state.go


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