%Joshua Chung and John Hartz

:- dynamic known/2.


mineral(_X) :-
	clear, fail.

mineral(adamite) :-
	hardness(3.5),
	color([green, yellow, purple, white]),
	fracture(conchoidal),
	cleavage(domal),
	luster(adamantine),
	streak(white).

mineral(copper) :-
	hardness(3),
	color([green]),
	fracture(jagged),
	cleavage(absent),
	luster(metallic),
	streak(red).

mineral(diamond) :-
	hardness(10),
	color([clear, blue, white, gray, black]),
	fracture(conchoidal),
	cleavage(planar),
	luster(adamantine),
	streak(clear).

mineral(gold) :-
	hardness(3),
	color([yellow]),
	fracture(jagged),
	cleavage(absent),
	luster(metallic),
	streak(yellow).

mineral(ice) :-
	hardness(1.5),
	color([clear, white]),
	fracture(conchoidal),
	cleavage(absent),
	luster(vitreous),
	streak(clear).

mineral(iron) :-
	hardness(5),
	color([gray, black]),
	fracture(hackly),
	cleavage(absent),
	luster(metallic),
	streak(metallic).

mineral(lead) :-
	hardness(1.5),
	color([gray]),
	fracture(jagged),
	cleavage(absent),
	luster(metallic),
	streak(gray).

mineral(nickel) :-
	hardness(5),
	color([blue]),
	fracture(hackly),
	cleavage(absent),
	luster(metallic),
	streak(gray).

mineral(opal) :-
	hardness(6),
	color([white, colorless, yellow, red, gray, black]),
	fracture(conchoidal),
	cleavage(absent),
	luster(pearly),
	streak(white).

mineral(platinum) :-
	hardness(4.5),
	color([white, gray, silver]),
	fracture(jagged),
	cleavage(absent),
	luster(metallic),
	streak(gray).

mineral(quartz) :-
	hardness(7),
	color([white, purple, pink, gray, brown, black]),
	fracture(conchoidal),
	cleavage(rhombohedral),
	luster(glassy),
	streak(white).

mineral(silicon) :-
	hardness(7),
	color([black, silver, gray, brown]),
	fracture(conchoidal),
	cleavage(absent),
	luster(metallic),
	streak(black).

mineral(silver) :-
	hardness(3),
	color([silver]),
	fracture(jagged),
	cleavage(absent),
	luster(metallic),
	streak(silver).

mineral(talc) :-
	hardness(1),
	color([green, white, gray, yellow, brown]),
	fracture(uneven),
	cleavage(planar),
	luster(pearly),
	streak(white).

mineral(topaz) :-
	hardness(8),
	color([clear, yellow, orange, red, blue, green]),
	fracture(conchoidal),
	cleavage(basal),
	luster(vitreous),
	streak(white).
	

hardness(V) :-
	ask(hardness,'Value between 1 - 10',V).

color(V) :- cc(V).

cc([]) :- fail.
cc([H|_T]) :- ask(color,'black, blue, brown, clear, colorless, gray, green, orange, pink, purple, red, silver, white, yellow',H), !.
cc([_H|T]) :- cc(T).

fracture(V) :-
	ask(fracture,'conchoidal, hackly, jagged, uneven',V).

cleavage(V) :-
	ask(cleavage,'absent, basal, domal, planar, rhombohedral',V).

luster(V) :-
	ask(luster,'adamantine, glassy, metallic, pearly, vitreous',V).

streak(V) :-
	ask(streak,'black, red, clear, gray, metallic, silver, white, yellow',V), !.


ask(A,_M,V) :-
	known(A,V), !.
ask(A,_M,_V) :-
	known(A,_), !, fail.
ask(A,M,V) :-
	nl, write('What is the '),
	write(A),
	write(' ? (please choose one)'),
	nl, write(M), nl,
	read(X),
	asserta(known(A,X)), !,
	V == X.

clear :-
       retractall(known(_X,_Y)).