Programmer Passport: Prolog: apply_constraints checks morning game twice (page 60)

In this code:

apply_constraints(MatchA, MatchB, PotentialMatches, RemainingMatches, Day) :-
    different_teams(MatchA, MatchB),
    can_play(MatchA, morning, Day),
    can_play(MatchB, morning, Day),
    subtract(PotentialMatches, [MatchA, MatchB], RemainingMatches).

the second can_play clause should be checking the afternoon rather than the morning. This would be more obvious if the games were called MorningMatch and AfternoonMatch rather than MatchA and MatchB.

@redrapids

on a similar note here, the cant_play restrictions should have their team names in quotes :
cant_play(“comets”, morning, “July 2”).
cant_play(“stars”, afternoon, “July 23”)