%%%%%%%%%%%%%%%%%%%%%%%
% Michalski's train problem. This involves 5 eastbound trains and
%	5 westbound trains. Learns simple rule which distinguishes
%	between eastbound and westbound trains.

%%%%%%%%%%%%%%%%%%%%%%%

:- set(h,1000)?
:- set(r,1000)?
%:- set(c,7)?
:- set(nodes,1000)? %
%:- set(c,12)?


%:- modeh(1,east(+train))?
:- modeh(1,east([+car|+clist]))?
:- modeb(*,infront(+car,-car))?
%:- modeb(*,has_car(+train,-car))?
%:- modeb(*,has_car2(+train,-car))?
:- modeb(*,has_car2(+clist,-car))?

:- modeb(1,east(+clist))?
%:- modeb(1,not open(+car))?
%:- modeb(1,not long(+car))?
:- modeb(1,long(+car))?
:- modeb(1,open(+car))?
:- modeb(1,double(+car))?
:- modeb(1,jagged(+car))?
:- modeb(1,closed(+car))?
:- modeb(1,short(+car))?
:- modeb(1,shape(+car,#shape))?
:- modeb(1,load(+car,#shape,#int))?
:- modeb(1,wheels(+car,#int))?
:- modeb(*,has_load1(+clist,#shape))?

%:- modeb(1,shape(+car,-shape))?
%:- modeb(1,load(+car,-shape,-int))?
%:- modeb(1,wheels(+car,-int))?
%:- modeb(1,infront(+car,-car))?


clist([]).
clist([H|T]) :- car(H), clist(T).

has_car2(T,C):-
	member(C,T).

member(X,[X|_]).
member(X,[_|T]) :- member(X,T).

has_load1(T,Shape) :- has_car2(T,C), load(C,Shape,_).


%%%%%%%%%%%%%%%

shape(elipse).  shape(hexagon).  shape(rectangle).  shape(u_shaped).
