You selected quiz1.pl
headline:-
  wn('% --------------------------------------'),
  wn('%�@�v�����[�O�ɂ��~�j�E�N�C�Y�V�X�e��'),
  wn('% --------------------------------------'),
  wn('% type go and period to start the system. '),
  nl.
me:-
  wn('% file: quia1.pl'),
  wn('% created: 16 May 2002'),
  wn('% edited: 5 Mar 2003'),
  wn('% edited: 21 Mar 2003'),
  wn('% edited: 26 Mar 2003'),
  nl.

%--------------------------------
%�@���f�[�^�x�[�X
%--------------------------------

%�@��蕶�́A�I��A����ѐ���

'����'(1,'��蕶','What is "karasumi" ?',_).
'����'(1,'�I��'(1),'A kind of cat',no).
'����'(1,'�I��'(2),'A kind of dog',no).
'����'(1,'�I��'(3),'A kind of bird',no).
'����'(1,'�I��'(4),'A kind of machine',no).
'����'(1,'�I��'(5),'A kind of food',yes).

'����'(2,'��蕶','Can it fly?',_).
'����'(2,'�I��'(1),'No. It can not fly.',yes).
'����'(2,'�I��'(2),'Yes. It can fly, sometimes. ',no).
'����'(2,'�I��'(3),'I hope not.',no).
'����'(2,'�I��'(4),'I do not know. ',no).

question(N,problem,Q,Y):-
   '����'(N,'��蕶',Q,Y).
question(N,alternative(NofAlt),S,Ans):-
   '����'(N,'�I��'(NofAlt),S,Ans).

%--------------------------------
%�@�N�C�Y�o��E�̓_�v���O����
%--------------------------------

quiz(N):-
  question(N,problem,Text,_),
  wr_question(Text,60),
  wr_alternative(N),
  user_input(User),
  wr_result(N,User,M),
  wr_star_and_sentence(M,30).


%--------------------------------
%�@�ȈՃC���^�t�F�[�X
%--------------------------------

%�@��蕶�͂̕\�� etc.

wr_question(B,Y):-
  wr_star_and_sentence(B,Y).

wr_star_and_sentence(B,Y):-
  wr_star(_,Y),
  nl,tab(4),write(B),nl,
  wr_star(_,Y),
  nl.

%�@'�I��'�̕\��

wr_alternative(N):-
   question(N,alternative(X),Y,_),
   tab(5),write(X),write('.  '),write(Y),nl,fail.
wr_alternative(_):-!.


%�@�̓_���ʕ\��

wr_result(N,User,M):- 
  question(N,alternative(User),_,yes)
  -> M = 'right. congratulation!'
  ;  M = 'wrong. good luck!'.


%�@���[�U�[�ɂ��񓚓���

user_input(User):-
  nl,tab(4),write('Type a number ( �ԍ����)->'),
  read(User).


%--------------------------------
%�@���̑��̃��[�e�B���e�B�[
%--------------------------------

% �f�[�^�̉�ʕ\��

wn(Z):- write(Z), nl.

'����'(X):-  write(X).


%�@�����C���̌J��Ԃ�

wr_star([],0).
wr_star(L,N):-
  length(L,N),
  X='*',
  L=[X|Y],
  write(X),
  wr_star(Y,N1),
  N1 is N - 1.


% ---------------------
%�@���s�J�n�E�I��
% ---------------------
go:-
  quiz(_N),fail.

%  �����グ�����s
%:-go.
:- headline.

%�@�v���O�����̏I���


return to front page.