コード例 #1
0
ファイル: island.go プロジェクト: glycerine/gologic
func disconnected(a, b interface{}) l.Goal {
	x, y := l.Fresh2()
	return l.And(
		north_south_bridge(a, x),
		l.Neq(x, b),
		west_east_bridge(a, y),
		l.Neq(y, b))
}
コード例 #2
0
ファイル: archfriends.go プロジェクト: glycerine/gologic
func archo(q l.V) l.Goal {
	a, b := l.Fresh2()
	membero := l.StructMemberoConstructor4(t)
	return l.And(
		membero(Purchase{"The Foot Farm", v()}, q),
		membero(Purchase{"Heels in a Handcart", v()}, q),
		membero(Purchase{"The Shoe Palace", v()}, q),
		membero(Purchase{"Tootsies", v()}, q),
		membero(Purchase{v(), "ecru espadrilles"}, q),
		membero(Purchase{v(), "fuchsia flats"}, q),
		membero(Purchase{v(), "purple pumps"}, q),
		membero(Purchase{v(), "suede sandals"}, q),
		// 1
		membero(Purchase{"Heels in a Handcart", "fuchsia flats"}, q),
		// 3
		l.Unify(Trip{v(), Purchase{"The Foot Farm", v()}, v(), v()}, q),
		// 4
		aftero(Purchase{"The Shoe Palace", v()}, b, q),
		aftero(b, Purchase{v(), "suede sandals"}, q),
		// 2
		aftero(Purchase{v(), "purple pumps"}, Purchase{a, v()}, q),
		l.Neq(a, "Tootsies"),
	)

}
コード例 #3
0
ファイル: news.go プロジェクト: glycerine/gologic
func newso(q l.V) l.Goal {
	baby_location := v()
	jimmy_location := v()
	lois_story := v()
	pc_story := v()
	sm_story := v()
	corey_location := v()
	whale_location := v()
	return l.And(
		l.Unify(News{Report{"Corey", corey_location, v()}, Report{"Jimmy", jimmy_location, v()}, Report{"Lois", v(), lois_story}, Report{"Perry", v(), v()}}, q),

		// 1
		l.Neq(baby_location, "South Amboy"),
		l.Neq(baby_location, "New Hope"),

		// 2
		l.Neq(jimmy_location, "Port Charles"),

		// 3
		l.Or(l.And(l.Unify(lois_story, "blimp launching"), l.Unify(pc_story, "skyscraper dedication")),
			l.And(l.Unify(lois_story, "skyscraper dedication"), l.Unify(pc_story, "blimp launching"))),

		// 5
		l.Or(l.Unify(corey_location, "Bayonne"),
			l.Unify(whale_location, "Bayonne"),
			l.And(l.Unify(corey_location, "Bayonne"),
				l.Unify(whale_location, "Bayonne"))),

		//
		membero(Report{v(), "Bayonne", v()}, q),
		membero(Report{v(), "New Hope", v()}, q),
		membero(Report{v(), "Port Charles", pc_story}, q),
		membero(Report{v(), "South Amboy", sm_story}, q),

		membero(Report{v(), baby_location, "30 pound baby"}, q),
		membero(Report{v(), v(), "blimp launching"}, q),
		membero(Report{v(), v(), "skyscraper dedication"}, q),
		membero(Report{v(), whale_location, "beached whale"}, q),

		// 4
		l.Neq(sm_story, "beached whale"),
		l.Neq(sm_story, "skyscraper dedication"),
	)
}
コード例 #4
0
ファイル: golf.go プロジェクト: glycerine/gologic
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),
	)
}