Ejemplo n.º 1
0
func scoreo(q interface{}) l.Goal {
	a, b, c, d := l.Fresh4()
	return l.And(
		l.Unify(Round{Dude{v(), v(), v(), a}, Dude{v(), v(), v(), b}, Dude{v(), v(), v(), c}, Dude{v(), v(), v(), d}}, q),
		betweeno(a, 70, 85),
		betweeno(b, 70, 85),
		betweeno(c, 70, 85),
		betweeno(d, 70, 85))
}
Ejemplo n.º 2
0
func islando(q l.V) l.Goal {
	db.Assert("A", North_of, "C")
	db.Assert("B", North_of, "D")
	db.Assert("D", East_of, "C")
	db.Assert("B", East_of, "A")

	membero := l.StructMemberoConstructor4(n)

	alabaster_island, durian_island, banana_island := l.Fresh3()
	pwana_island, quero_island, skern_island, rayou_island := l.Fresh4()
	hotel_island, koala_island, jai_island, skating_island := l.Fresh4()

	return l.And(
		l.Unify(Nation{Island{"A", v(), v(), v()}, Island{"B", v(), v(), v()}, Island{"C", v(), v(), v()}, Island{"D", v(), v(), v()}}, q),
		// 1
		north_of(pwana_island, koala_island),
		//2
		east_of(quero_island, alabaster_island),
		//3
		east_of(hotel_island, durian_island),
		//4
		north_south_bridge(skern_island, jai_island),
		//5
		west_east_bridge(rayou_island, banana_island),
		//6
		disconnected(skating_island, jai_island),
		//
		membero(Island{pwana_island, "Pwana", v(), v()}, q),
		membero(Island{quero_island, "Quero", v(), v()}, q),
		membero(Island{rayou_island, "Rayou", v(), v()}, q),
		membero(Island{skern_island, "Skern", v(), v()}, q),
		//
		membero(Island{alabaster_island, v(), "alabaster", v()}, q),
		membero(Island{banana_island, v(), "bananas", v()}, q),
		membero(Island{v(), v(), "coconuts", v()}, q),
		membero(Island{durian_island, v(), "durian fruit", v()}, q),
		//
		membero(Island{hotel_island, v(), v(), "hotel"}, q),
		membero(Island{skating_island, v(), v(), "ice skating rink"}, q),
		membero(Island{jai_island, v(), v(), "jai alai stadium"}, q),
		membero(Island{koala_island, v(), v(), "koala preserve"}, q),
	)
}
Ejemplo n.º 3
0
func golfo(q l.V) l.Goal {
	membero := l.StructMemberoConstructor4(func(a, b, c, d interface{}) interface{} { return Round{a, b, c, d} })
	bills_job := v()
	bills_score := v()
	mr_clubb_first_name := v()
	mr_clubbs_score := v()
	pro_shop_clerk_score := v()
	frank_score := v()
	caddy_score := v()
	sands_score := v()
	score1, score2, score3, score4 := l.Fresh4()
	mr_carters_first_name := v()
	return l.And(
		l.Unify(Round{Dude{"Bill", v(), v(), score1}, Dude{"Jack", v(), v(), score2}, Dude{"Frank", v(), v(), score3}, Dude{"Paul", v(), v(), score4}}, q),
		l.Neq(score1, score2),
		l.Neq(score1, score3),
		l.Neq(score1, score4),
		l.Neq(score2, score3),
		l.Neq(score2, score4),
		l.Neq(score3, score4),

		membero(Dude{"Jack", v(), v(), v()}, q),
		membero(Dude{v(), "Green", v(), v()}, q),
		membero(Dude{v(), v(), "short-order cook", v()}, q),

		// // 1
		membero(Dude{"Bill", v(), bills_job, bills_score}, q),
		l.Neq(bills_job, "maintenance man"),
		membero(Dude{v(), v(), "maintenance man", v()}, q),
		l.Increasing(bills_score, score2),
		l.Increasing(bills_score, score3),
		l.Increasing(bills_score, score4),

		// // 2
		membero(Dude{mr_clubb_first_name, "Clubb", v(), mr_clubbs_score}, q),
		l.Neq(mr_clubb_first_name, "Paul"),
		membero(Dude{v(), v(), "pro-shop clerk", pro_shop_clerk_score}, q),
		l.Difference(mr_clubbs_score, 10, pro_shop_clerk_score),

		// //3
		membero(Dude{"Frank", v(), v(), frank_score}, q),
		membero(Dude{v(), v(), "caddy", caddy_score}, q),
		membero(Dude{v(), "Sands", v(), sands_score}, q),

		l.Or(l.And(l.Difference(frank_score, 7, sands_score),
			l.Difference(caddy_score, 4, sands_score)),
			l.And(l.Difference(frank_score, 4, sands_score),
				l.Difference(caddy_score, 7, sands_score))),

		// // // 4
		membero(Dude{mr_carters_first_name, "Carter", v(), 78}, q),
		l.Increasing(frank_score, 78),
		l.Neq(mr_carters_first_name, "Frank"),

		// // // 5
		l.Neq(score1, 81),
		l.Neq(score2, 81),
		l.Neq(score3, 81),
		l.Neq(score4, 81),

		scoreo(q),
	)
}