Question
P1.10.10 Suppose we have a set of sports teams in a league L, and a set of games G among thoseteams. Each game has a
"P1.10.10 Suppose we have a set of sports teams in a league L, and a set of games G among thoseteams. Each game has a home team and a visiting team, who are two dierent teams in theleague. We have predicates H(g, t) meaning team t was the home team in game g andV (g, t) meaning team t was the visiting team in game g.
(a) Consider the predicate P (s, t) meaning team s played a game against team t. Can youexpress this predicate in terms of the predicates H and V , along with boolean operators?Either do it or explain (informally) why you cannot.(b) If I have a list of the games played, and access to the H and V predicates, how could Icompute the value of P (s, t) given two teams s and t?
(c) (uses Java) Assume that you have a Java class Game that includes instance meth-ods boolean home(Team t) and boolean visitor (Team t). Write a static methodboolean played(Team s, Team t, Game[ ] season) that will input two teams andan array of games, and return true if and only if P (s, t) is true for the set of games inthe array."
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started