/*

CSE 341, 1999su
Assignment 4
alternate sample solutions, bus Prolog predicates
Ken Yasuhara 
July, 1999

*/


/* busConnects(Loc1,Loc2,BusNo) is true iff you can take BusNo between
 * Loc1 and Loc2 
 */

busConnects(Loc1,Loc2,BusNo) :-
  busServes(BusNo,Loc1),
  busServes(BusNo,Loc2),
  Loc1 \== Loc2.


/* busConnectsVia(Loc1,Loc2,Loc,BusNo1,BusNo2) is true iff you can
 * take BusNo1 from Loc1 to transfer location Loc, then take BusNo2 to
 * Loc2 
 */

busConnectsVia(Loc1,Loc2,Loc,BusNo1,BusNo2) :-
  busConnects(Loc1,Loc,BusNo1),
  busConnects(Loc2,Loc,BusNo2),
  BusNo1 \== BusNo2,
  Loc1 \== Loc2.


/* code below this point provided in assignment handout */

/* busServes(LineNo,Location) if Metro Bus No. LineNo serves, i.e. has
 * a stop in, area Location
 *
 * source:  http://transit.metrokc.gov/bus/area_maps/seattle.html
 */

busServes(7,universityDistrict).
busServes(7,capitolHill).
busServes(7,broadway).
busServes(7,downtown).
busServes(7,internationalDistrict).
busServes(7,rainierValley).
busServes(7,columbiaCity).
busServes(7,rainierBeach).

busServes(25,downtown).
busServes(25,eastlake).
busServes(25,montlake).
busServes(25,universityVillage).
busServes(25,childrensHospital).
busServes(25,laurelhurst).

busServes(46,governmentLocks).
busServes(46,ballard).
busServes(46,fremont).
busServes(46,wallingford).
busServes(46,universityDistrict).

busServes(44,governmentLocks).
busServes(44,ballard).
busServes(44,wallingford).
busServes(44,universityDistrict).
busServes(44,uwCampus).
busServes(44,montlake).

busServes(174,downtown).
busServes(174,sodo).
busServes(174,duwamish).
busServes(174,seaTacAirport).
busServes(174,midway).
busServes(174,federalWay).

busServes(34,tukwila).
busServes(34,duwamish).
busServes(34,gatewayCorporateCenter).
busServes(34,whiteCenter).
busServes(34,fauntleroy).
busServes(34,westSeattleJunction).
busServes(34,admiralDistrict).
 

/* end of file */