Ejemplo n.º 1
0
func BenchmarkMonteFull(b *testing.B) {
	rng := rand.New(rand.NewSource(1))

	start := torus.Location(136)
	l := start
	n := 0
	tn := 0
	s := 0
	for i := 0; i < b.N*NMonte; i++ {
		s++
		var d maps.Direction
		for _, d = range maps.Permute5(rng) {
			if d == maps.NoMovement {
				break
			} else if nl := M.LocStep[l][d]; maps.StepableItem[M.Grid[nl]] {
				l = nl
				break
			}
		}
		if l == 0 {
			l = start
			n++
			tn += s
			s = 0
		}
	}
	if arenachatty {
		log.Printf("mean steps to exit %.2f", float64(tn)/float64(n))
	}
}
Ejemplo n.º 2
0
func init() {
	file := "../replay/testdata/replay.0.json"
	match, err := replay.Load(file)
	if err != nil {
		log.Panicf("Load of %s failed %v", file, err)
	}
	M = match.Replay.GetMap()

	A = NewArena(M, torus.Location(9*96+11))
}
Ejemplo n.º 3
0
func TestArena(t *testing.T) {
	files := []string{
		"../replay/testdata/replay.0.json",
	}

	for _, file := range files {
		match, err := replay.Load(file)
		if err != nil {
			t.Errorf("Load of %s failed %v", file, err)
		}
		m := match.Replay.GetMap()

		a := NewArena(m, torus.Location(9*96+11))
		if chatty {
			log.Printf("Arena:\n%v", a)
		}
	}
}