
  zvirata:- go(zvire).
  zvirata:-write('Jsem zmaten, nevim, co to je').

  go(Odhad ):-
    not(rule(_,Odhad,_,_)),!,nl,
    write('Myslim, ze to je:'),write(Odhad).

  go(Odhad ):- rule(_,Odhad,Novy_odhad,Podminky),
    kontrola(Podminky),
    go(Novy_odhad).

  kontrola([Podminka|Zbytek] ):-
    cond(Podminka,TEXT),
    zeptejse(TEXT),
    kontrola(Zbytek).
  kontrola([]).

  zeptejse(TEXT):-
    write('je pravda ze '), write(TEXT), write(' (a./n.) :'),
    read(ANSWER),!, ANSWER='a'.


rule(1,zvire,obratlovec,[1]).
rule(2,zvire,rak,[2,3,4]).
rule(3,zvire,krab,[2,3,5]).
rule(4,zvire,hmyz,[2,6]).
rule(5,hmyz,brouk,[7]).
rule(6,hmyz,motyl,[8,9]).
rule(7,obratlovec,teplokrevny,[10]).
rule(8,obratlovec,studenokrevny,[11]).
rule(11,teplokrevny,savec,[12,13]).
rule(12,teplokrevny,ptak,[14]).
rule(13,savec,selma,[15]).
rule(14,savec,kopytnik,[16]).
rule(15,savec,tlustokozec,[17,18]).
rule(16,savec,opice,[19]).
rule(17,selma,kocka,[20]).
rule(18,selma,pes,[21]).
rule(19,selma,tygr,[22,23]).
rule(20,selma,jaguar,[22,24]).
rule(21,kopytnik,zebra,[23]).
rule(22,kopytnik,zirafa,[25,26,24]).
rule(23,kopytnik,koza,[27,28]).
rule(24,kopytnik,ovce,[27,29]).
rule(25,tlustokozec,slon,[30]).
rule(26,tlustokozec,nosorozec,[31]).
rule(27,tlustokozec,hroch,[32]).
rule(28,ptak,pstros,[33,25,26]).
rule(29,ptak,tucnak,[33,32]).
rule(30,ptak,albatros,[34]).
rule(31,ptak,papousek,[8]).
rule(32,studenokrevny,ryba,[32]).
rule(33,studenokrevny,plaz,[35]).
rule(34,ryba,kapr,[36,38]).
rule(35,ryba,uhor,[37,38]).
rule(36,ryba,zralok,[22]).
rule(37,plaz,had,[22,37]).
rule(37,plaz,zelva,[39]).
rule(37,plaz,krokodyl,[22,40]).
cond(1,'ma pevnou kostru').
cond(2,'nema pevnou kostru').
cond(3,'ma klepeta').
cond(4,'leze pozpatku').
cond(5,'leze do strany').
cond(6,'leta').
cond(7,'ma krovky').
cond(8,'je barevny').
cond(9,'seda na kvetiny').
cond(10,'ma stalou telni teplotu').
cond(11,'nema stalou krevni teplotu').
cond(12,'ma srst').
cond(13,'saje mleko').
cond(14,'ma peri').
cond(15,'zere maso').
cond(16,'ma kopyta').
cond(17,'je hodne velky').
cond(18,'ma tlustou kuzi').
cond(19,'je podobny cloveku').
cond(20,'mnouka').
cond(21,'steka').
cond(22,'je nebezpecny').
cond(23,'ma cerne pruhy').
cond(24,'ma cerne skvrny').
cond(25,'ma dlouhe nohy').
cond(26,'ma dlouhy krk').
cond(27,'ma rohy').
cond(28,'meci').
cond(29,'beci').
cond(30,'ma chobot').
cond(31,'ma na nose roh').
cond(32,'zije ve vode').
cond(33,'neleta').
cond(34,'leta dobre').
cond(35,'plazi se').
cond(36,'ji se k vanocum').
cond(37,'je dlouhy a uzky').
cond(38,'zije v rybniku').
cond(39,'ma krunyr').
cond(40,'preplaval Nil').












